:root{
    --screen-height: 100vh;
    --keyboard-offset: 0px;
    --ios-pwa-bottom-bleed: 0px;
    --ref-width: 941px;
    --ref-height: 1672px;
    --font-en: "Cormorant Garamond", Georgia, serif;
    --font-cn: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
    --wall-light: url("chat-light.webp");
    --wall-harbor: url("chat-harbor.webp");
    --wall-default: var(--wall-light);
    --menu-wall-light: url("menu-light.webp");
    --menu-wall-harbor: url("menu-harbor.webp");
    --menu-wall-default: var(--menu-wall-light);
    --avatar-default: url("avatar-sea.png");
    /* ── PEARL TIDE · 珍珠潮汐(default) ── */
    --bg: #F7FAFC;
    --header-bg: #F7FAFC;
    --hairline: rgba(120,142,165,.24);
    --text: #253447;
    --text-soft: #5E7080;
    --text-faint: #8A99A8;
    --bubble-ai-bg: #ECEEF3;
    --bubble-ai-fg: #253447;
    --bubble-ai-line: transparent;
    --bubble-human-bg: #DFE5EE;
    --bubble-human-fg: #253447;
    --bubble-human-line: transparent;
    --accent: #4C6378;
    --send-bg: #2C4056;
    --tick: #7E93A4;
    --accent-fg: #ffffff;
    --think-flourish: rgba(99, 121, 142, 0.52);
    --think-label: #6A7E8E;
    --think-body: #56697A;
    --composer-bg: #EEF4FA;
    --field-bg: rgba(247,250,252,.92);
    --field-line: rgba(151,169,181,.18);
    --shadow: 0 18px 46px rgba(74, 93, 108, 0.10);
    --soft-shadow: 0 14px 34px rgba(86, 104, 118, 0.08);
    --scrim: linear-gradient(180deg, rgba(255,255,255,0.38), rgba(255,255,255,0.12) 30%, rgba(255,255,255,0.04) 68%, rgba(255,255,255,0.22));
    --header-h: clamp(56px, 10vw, 120px);
    --side-pad: clamp(16px, 4vw, 40px);
    --avatar-size: clamp(32px, 5vw, 48px);
    --bubble-radius: clamp(14px, 2vw, 20px);
    --composer-h: clamp(44px, 6vw, 72px);
    --motion-fast: 150ms;
    --motion-normal: 260ms;
    --ease-soft: cubic-bezier(0.22, 1, 0.36, 1);
    /* composer 占据的底部区域(含安全区/键盘):scroll 底 padding 与边缘渐隐共用同一来源,保持对齐 */
    --composer-zone: calc(var(--composer-h) + 16px + env(safe-area-inset-bottom) + var(--keyboard-offset));
    --edge-fade-top: clamp(24px, 5vw, 52px);
    --edge-fade-tail: clamp(16px, 3vw, 30px);
    /* profile / settings — frosted glass, blends into the wallpaper */
    --card-bg: rgba(244,248,250,.42);
    --card-line: rgba(150,168,182,.12);
    --card-shadow: 0 10px 28px rgba(70,92,108,.05);
    --seg-track: rgba(140,160,176,.11);
    --seg-thumb: rgba(255,255,255,.68);
    --seg-thumb-shadow: 0 2px 8px rgba(40,60,78,.08);
    --row-press: rgba(140,160,176,.09);
    --slider-track: rgba(143,162,176,.28);
    --slider-thumb: #44627b;
    --info-ring: rgba(143,162,176,.38);
    --status-dot: #5fbf8f;
    /* voice call (speaking overlay) */
    --call-glass-top: rgba(255,255,255,.46);
    --call-glass-bot: rgba(255,255,255,.20);
    --call-glass-edge: rgba(255,255,255,.58);
    --call-glass-hi: rgba(255,255,255,.72);
    --call-glass-glow: rgba(150,172,196,.20);
    --call-glass-shadow: 0 20px 50px rgba(74,93,108,.16);
    --call-scrim: rgba(64,82,102,.06);
    --call-hangup-bg: #cf8d92;
    --call-hangup-shadow: rgba(176,96,104,.34);
  }
  /* ── HARBOR · 海港(通用开源主题 / Tidal Echo) ── 中性冷调,供 fork 使用;只覆盖带色相变量,其余继承 PEARL TIDE */
  :root[data-theme="harbor"]{
      --wall-default: var(--wall-harbor);
      --menu-wall-default: var(--menu-wall-harbor);
      --bg: #F4F2EF;
      --header-bg: #F4F2EF;
      --hairline: rgba(74,93,108,.20);
      --text: #36404B;
      --text-soft: #5E6B78;
      --text-faint: #9197A0;
      --bubble-ai-bg: #EAE6E4;
      --bubble-ai-fg: #36404B;
      --bubble-human-bg: #E1E0E3;
      --bubble-human-fg: #36404B;
      --accent: #4A5D6C;
      --send-bg: #4A5D6C;
      --tick: #7E8E9C;
      --accent-fg: #ffffff;
      --think-flourish: rgba(74, 93, 108, 0.48);
      --think-label: #5E6B78;
      --think-body: #4F5D6A;
      --composer-bg: #EFEBE8;
      --field-bg: rgba(244,242,239,.92);
      --slider-thumb: #4A5D6C;
      --status-dot: #6FA98C;
  }

  *{ box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
  html, body{ margin:0; padding:0; height:100%; overflow:hidden; overscroll-behavior:none; }
  body{ position: fixed; inset: 0; width: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-cn);
    font-size: clamp(14px, 1.45vw, 16px);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overscroll-behavior: none;
  }

  .app{
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1;
    width: min(100vw, var(--ref-width));
    margin: 0 auto;
    overflow: hidden;
  }
  .wall{
    position:fixed;
    inset:0;
    width:100vw;
    height:var(--screen-height);
    z-index:0;
    background-color: var(--bg);
    background-image: var(--wall-default);
    background-size: cover; background-position: center;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
  }
  .wall::after{
    content:""; position:absolute; inset:0; background: var(--scrim); pointer-events:none;
  }
  .topbar, .scroll, .composer{ position: relative; z-index: 1; }

  /* ── Header (floating frosted pill + corner avatar) ── */
  .topbar{
    position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; justify-content: center;
    height: calc(var(--header-h) + env(safe-area-inset-top));
    padding: calc(env(safe-area-inset-top) + 8px) var(--side-pad) 10px;
    border-bottom: 1px solid var(--hairline);
    pointer-events: none;
  }
  .topbar > *{ pointer-events: auto; }
  .peerpill{
    display:flex; flex-direction:column; align-items:center; line-height:1.15;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0 76px;
  }
  .peerpill .name{
    font-family: "Songti SC", "Noto Serif SC", "STSong", "SimSun", serif;
    font-size: clamp(18px, 3vw, 28px);
    font-weight: 500;
    color: var(--text);
    letter-spacing: 0;
    text-shadow: 0 1px 18px rgba(255,255,255,0.3);
  }
  .peerpill .status{
    font-family: var(--font-en), var(--font-cn);
    font-size: clamp(12px, 1.8vw, 16px);
    color: var(--text-soft);
    margin-top: 4px;
    letter-spacing: 0;
  }
  .app[data-conn="reconnecting"] .peerpill .status{ color:#9a8061; }
  .peerpill .status.typing{
    color: #4f9fda;
    font-weight: 500;
    text-shadow: 0 0 16px rgba(79,159,218,.24);
    display: inline-flex; align-items: center;
  }
  .typing-dots{ display:inline-flex; align-items:center; gap:3px; margin-left:6px; }
  .typing-dots i{ width:4px; height:4px; border-radius:50%; background:currentColor; animation: typingDot 1.25s ease-in-out infinite; }
  .typing-dots i:nth-child(2){ animation-delay:.16s; }
  .typing-dots i:nth-child(3){ animation-delay:.32s; }
  @keyframes typingDot{ 0%,70%,100%{ transform:translateY(0); opacity:.4; } 35%{ transform:translateY(-3px); opacity:1; } }
  .backbtn{
    position:absolute; left: calc(var(--side-pad) + 4px); top: calc(env(safe-area-inset-top) + clamp(14px, 2.5vw, 36px));
    width:36px; height:36px; border-radius:50%; padding:0; flex:none; cursor:pointer;
    border: none; background: transparent;
    color: var(--text); display:grid; place-items:center;
    transition: transform .15s ease;
  }
  .backbtn:active{ transform: scale(.9); }
  .backbtn svg{ width:22px; height:22px; display:block; margin-left:-2px; }
  .header-actions{
    position:absolute;
    right: calc(var(--side-pad) - 2px);
    top: calc(env(safe-area-inset-top) + clamp(14px, 2.5vw, 36px));
    display:flex;
    align-items:center;
    justify-content:flex-end;
    gap: clamp(24px, 4vw, 42px);
    height:36px;
  }
  .topbtn{
    width:36px;
    height:36px;
    border:0;
    border-radius:50%;
    padding:0;
    background:transparent;
    color: var(--text);
    display:grid;
    place-items:center;
    cursor:pointer;
    transition: transform .15s ease;
  }
  .topbtn:active{ transform: scale(.9); }
  .topbtn svg{ width:24px; height:24px; display:block; }
  .topbtn.more svg{ width:22px; height:22px; }
  .topbtn.terminal.active{ color:var(--accent); }
  .session-pop{
    position:absolute;
    right: calc(var(--side-pad) + 34px);
    top: calc(env(safe-area-inset-top) + clamp(58px, 8vw, 82px));
    z-index:30;
    width:min(82vw, 320px);
    max-height:min(58vh, 480px);
    overflow:auto;
    padding:10px;
    border-radius:18px;
    background:var(--panel-bg);
    border:1px solid var(--card-line);
    box-shadow:0 18px 50px rgba(30,45,62,.18);
    -webkit-backdrop-filter:blur(18px);
    backdrop-filter:blur(18px);
  }
  .session-pop[hidden]{ display:none !important; }
  .session-head{ display:flex; align-items:center; justify-content:space-between; gap:8px; padding:4px 2px 8px; }
  .session-title{ font-size:12px; color:var(--text-faint); font-family:var(--font-en), var(--font-cn); }
  .session-new{
    border:1px solid var(--seg-line); border-radius:999px; padding:5px 9px;
    background:var(--seg-track); color:var(--text-soft); font:inherit; font-size:11.5px; cursor:pointer;
  }
  .session-list{ display:flex; flex-direction:column; gap:2px; }
  .session-item{
    border:0; width:100%; background:transparent; color:var(--text);
    display:grid; grid-template-columns:1fr auto; align-items:center; gap:8px;
    padding:10px 9px; border-radius:12px; text-align:left; cursor:pointer; font:inherit;
  }
  .session-item.active{ background:var(--seg-track); }
  .session-item:active{ transform:scale(.992); }
  .session-main{ min-width:0; display:flex; flex-direction:column; align-items:flex-start; gap:3px; }
  .session-name{ font-size:14px; line-height:1.25; }
  .session-meta{ font-size:11px; color:var(--text-faint); font-family:var(--font-en), var(--font-cn); }
  .session-rename{
    border:0; background:transparent; color:var(--text-faint); width:28px; height:28px;
    border-radius:50%; display:grid; place-items:center; cursor:pointer; padding:0;
  }
  .session-rename:hover{ color:var(--accent); background:var(--seg-track); }
  .session-rename svg{ width:15px; height:15px; display:block; }
  .terminal-panel{
    position:fixed;
    inset:0;
    z-index:260;
    display:flex;
    flex-direction:column;
    background:#050607;
    color:#d7f7df;
    font-family:"SFMono-Regular", Consolas, "Cascadia Mono", monospace;
    transform:translateX(100%);
    transition:transform .24s cubic-bezier(.2,.8,.2,1);
  }
  .terminal-panel.open{ transform:translateX(0); }
  .terminal-top{
    flex:none;
    min-height:calc(52px + env(safe-area-inset-top));
    display:flex;
    align-items:center;
    gap:10px;
    padding:calc(env(safe-area-inset-top) + 8px) 12px 8px;
    border-bottom:1px solid rgba(157,255,188,.18);
    background:#080a0b;
  }
  .terminal-back{
    flex:none;
    width:34px;
    height:34px;
    border:0;
    border-radius:50%;
    background:transparent;
    color:#d7f7df;
    display:grid;
    place-items:center;
    padding:0;
    cursor:pointer;
  }
  .terminal-back:active{ transform:scale(.9); }
  .terminal-back svg{ width:21px; height:21px; display:block; }
  .terminal-title{ min-width:0; display:flex; flex-direction:column; gap:2px; line-height:1.15; }
  .terminal-title strong{ font-size:14px; font-weight:600; color:#effff4; }
  .terminal-title span{
    font-size:11px;
    color:rgba(215,247,223,.62);
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
  }
  .terminal-log{
    flex:1 1 auto;
    overflow:auto;
    padding:14px 14px 18px;
    font-size:13px;
    line-height:1.55;
    white-space:pre-wrap;
    overflow-wrap:anywhere;
  }
  .term-entry{ margin:0 0 13px; }
  .term-user{ color:#9dffbc; }
  .term-assistant{ color:#d7f7df; }
  .term-tool{
    color:#b6d6ff;
    border-left:2px solid rgba(126,174,255,.45);
    padding-left:10px;
  }
  .term-muted{ color:rgba(215,247,223,.48); }
  .term-cmd{ color:#9dffbc; }
  .term-err{ color:#ffb0a3; }
  .terminal-form{
    flex:none;
    display:flex;
    align-items:flex-end;
    gap:9px;
    padding:10px 12px calc(10px + env(safe-area-inset-bottom));
    border-top:1px solid rgba(157,255,188,.18);
    background:#080a0b;
  }
  .terminal-prompt{ flex:none; color:#9dffbc; font-size:15px; line-height:34px; }
  .terminal-input{
    flex:1 1 auto;
    min-width:0;
    max-height:120px;
    border:0;
    outline:0;
    resize:none;
    background:transparent;
    color:#effff4;
    font:inherit;
    font-size:15px;
    line-height:1.45;
    padding:6px 0;
  }
  .terminal-input::placeholder{ color:rgba(215,247,223,.34); }
  .terminal-send{
    flex:none;
    width:34px;
    height:34px;
    border:1px solid rgba(157,255,188,.34);
    border-radius:50%;
    background:rgba(157,255,188,.1);
    color:#d7f7df;
    display:grid;
    place-items:center;
    padding:0;
    cursor:pointer;
  }
  .terminal-send:active{ transform:scale(.92); }
  .terminal-send svg{ width:18px; height:18px; display:block; }
  .avatar{
    position:absolute; right: calc(var(--side-pad) - 3px); top: calc(env(safe-area-inset-top) + clamp(14px, 2.5vw, 36px));
    width: var(--avatar-size); height: var(--avatar-size); border-radius:50%; padding:0; flex:none; cursor:pointer;
    border: none;
    background-image: var(--avatar-default);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow: hidden;
    box-shadow: 0 12px 24px rgba(24,46,67,0.16);
  }
  .avatar:focus-visible,
  .backbtn:focus-visible,
  button:focus-visible,
  textarea:focus-visible,
  input:focus-visible{
    outline: 2px solid var(--accent);
    outline-offset: 3px;
  }

  /* ── Messages ── */
  .scroll{
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    overflow-anchor: none;
    padding: clamp(14px, 2.4vw, 28px) var(--side-pad) var(--composer-zone);
    display: flex; flex-direction: column;
    transition: padding-bottom .28s cubic-bezier(.2,.8,.2,1);
    /* 边缘渐隐:顶部一段、底部对齐 composer 上沿一段,消息滚到边缘自然淡出 */
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 var(--edge-fade-top), #000 calc(100% - var(--composer-zone)), transparent calc(100% - var(--composer-zone) + var(--edge-fade-tail)));
    mask-image: linear-gradient(to bottom, transparent 0, #000 var(--edge-fade-top), #000 calc(100% - var(--composer-zone)), transparent calc(100% - var(--composer-zone) + var(--edge-fade-tail)));
    -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  }
  .scroll::-webkit-scrollbar{ width:0; height:0; }
  .v-spacer{
    flex: 0 0 auto;
    width: 100%;
    min-height: 0;
    pointer-events: none;
  }

  .day{
    align-self: center;
    margin: 0;
    font-family: var(--font-en), var(--font-cn);
    font-size: clamp(12px, 1.6vw, 16px); color: var(--text-faint);
    padding: 0;
    border-radius: 0;
    background: transparent;
    border: none;
  }

  .row{ display:flex; position:relative; margin-top: clamp(14px, 2.2vw, 28px); }
  .day + .row{ margin-top: clamp(12px, 1.8vw, 20px); }
  .new-divider{
    display:flex;
    align-items:center;
    justify-content:center;
    gap: clamp(16px, 2.4vw, 24px);
    margin: clamp(16px, 2.4vw, 28px) 0 clamp(12px, 1.8vw, 20px);
    color: var(--text-faint);
    font-family: var(--font-en), var(--font-cn);
    font-size: clamp(12px, 1.6vw, 16px);
    line-height:1;
    letter-spacing:0;
  }
  .new-divider::before,
  .new-divider::after{
    content:"";
    width: clamp(94px, 24vw, 226px);
    height:1px;
    background: var(--hairline);
  }
  .row.grouped{ margin-top: clamp(4px, 0.8vw, 8px); }
  .row.human{ justify-content: flex-end; }
  .row.ai{ justify-content: flex-start; padding-left: calc(var(--avatar-size) + clamp(10px, 1.6vw, 16px)); }
  .row.ai::before{
    content:"";
    position:absolute;
    left:0;
    top: clamp(5px, 1vw, 9px);
    width: var(--avatar-size);
    height: var(--avatar-size);
    border-radius: 50%;
    background-image: var(--avatar-default);
    background-size: cover;
    background-position: center;
    box-shadow: 0 12px 24px rgba(24,46,67,0.14);
  }

  .bubble{
    max-width: min(61vw, 506px);
    padding: clamp(8px, 1.05vw, 12px) clamp(13px, 1.65vw, 18px) clamp(8px, 1.1vw, 13px);
    border-radius: var(--bubble-radius);
    position: relative;
    font-family: var(--font-cn);
    font-size: clamp(14px, 1.55vw, 16px); line-height: 1.58;
    word-wrap: break-word;
    overflow-wrap: break-word;
    animation: pop .24s cubic-bezier(.2,.8,.2,1) both;
  }
  .row[data-vkey] .bubble,
  .row[data-vkey] .think-block{ animation: none; }
  @keyframes pop{ from{ transform: translateY(5px) scale(.99);} to{ transform:none;} }
  /* 新消息入场:轻微弹性,只对刚发/刚收到那条播一次(虚拟列表复用不重播,JS 控 enter class) */
  .row[data-vkey].enter-human .bubble{ transform-origin: bottom right; animation: enterHuman .44s cubic-bezier(.34,1.46,.5,1) both; }
  .row[data-vkey].enter-ai .bubble{ transform-origin: bottom left; animation: enterAi .44s cubic-bezier(.34,1.46,.5,1) both; }
  @keyframes enterHuman{ from{ transform: translate(6px, 9px) scale(.95); opacity:0; } 55%{ opacity:1; } to{ transform:none; opacity:1; } }
  @keyframes enterAi{ from{ transform: translate(-6px, 9px) scale(.95); opacity:0; } 55%{ opacity:1; } to{ transform:none; opacity:1; } }
  .row.ai .bubble{
    background: var(--bubble-ai-bg);
    color: var(--bubble-ai-fg);
    border: 0;
    box-shadow: 0 10px 28px rgba(78, 94, 108, 0.08);
  }
  .row.human .bubble{
    background: var(--bubble-human-bg);
    color: var(--bubble-human-fg);
    border: 0;
    box-shadow: 0 10px 28px rgba(78, 94, 108, 0.08);
  }
  /* 每段最后一条:外下角收一个小尖 */
  .row.ai.tail .bubble{ border-bottom-left-radius: 2px; }
  .row.human.tail .bubble{ border-bottom-right-radius: 2px; }

  .bubble .txt{ white-space: normal; }
  .bubble.has-att{ display:flex; flex-direction:column; gap:6px; }
  .bubble.att-only{ background:transparent !important; padding:0 !important; box-shadow:none !important; }
  .att-img-link{ display:block; line-height:0; border-radius:14px; overflow:hidden; width:min(64vw,260px); aspect-ratio:var(--att-ratio, 1.04); max-height:340px; background:rgba(125,128,135,.10); }
  .att-img{ display:block; width:100%; height:100%; object-fit:cover; border-radius:14px; }
  .att-file{ display:flex; align-items:center; gap:10px; padding:9px 11px; min-width:170px; max-width:250px; text-decoration:none; color:inherit; background:rgba(125,128,135,.12); border-radius:12px; }
  .att-file-ic{ flex:0 0 auto; width:36px; height:36px; display:grid; place-items:center; border-radius:9px; background:rgba(125,128,135,.20); }
  .att-file-ic svg{ width:20px; height:20px; opacity:.85; }
  .att-file-meta{ display:flex; flex-direction:column; min-width:0; }
  .att-file-name{ font-size:13px; font-weight:600; line-height:1.3; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .att-file-size{ font-size:11px; opacity:.6; margin-top:2px; }
  .att-uploading{ opacity:.62; }
  .att-img-dead img{ display:none; }
  .att-img-dead::after{ content:"⚠ 图片已失效"; display:inline-block; padding:16px 20px; font-size:12px; color:var(--text-faint); background:rgba(125,128,135,.14); border-radius:14px; }
  .att-failed{ outline:1.5px solid #e3534d; outline-offset:1px; }
  .bubble .txt a{ color: inherit; text-decoration: underline; text-underline-offset: 2px; }
  .bubble .txt code{
    font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .92em;
    background: rgba(120,100,80,0.14); padding: 1px 5px; border-radius: 5px;
  }
  .bubble .txt strong{ font-weight: 700; }
  .meta{
    display:inline; margin-left: clamp(10px, 1.4vw, 16px); white-space: nowrap;
    font-family: var(--font-en), var(--font-cn);
    font-size: clamp(11px, 1.3vw, 14px); color: var(--text-faint); user-select:none;
    vertical-align: baseline;
  }
  .meta .tick{ color: var(--tick); margin-left: 7px; letter-spacing:0; }
  .meta .state{ color: var(--accent); }
  .meta .fail{ color:#c0533f; cursor:pointer; }
  .row.human .meta,
  .row.ai .meta{ color: var(--text-faint); }
  .row.human .meta .tick,
  .row.ai .meta .tick{ color: var(--tick); }
  /* 发送中:小时钟,转完即送达 → 同位换成 ✓✓ */
  .meta .tick.clock{ color: var(--tick); }
  .meta .tick.clock svg{ width: 1.05em; height: 1.05em; vertical-align: -0.18em; }

  /* ── thinking ── collapsed follows AI bubble; expanded becomes a quiet reading section ── */
  .row.think{
    justify-content: flex-start;
    padding-left: calc(var(--avatar-size) + clamp(10px, 1.6vw, 16px));
    padding-right: 0;
    margin-top: clamp(7px, 1.2vw, 12px);
    margin-bottom: clamp(10px, 1.8vw, 18px);
  }
  .row.think.think-open{
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
    margin-top: clamp(20px, 3.2vw, 34px);
    margin-bottom: clamp(18px, 2.8vw, 28px);
  }
  .think-block{
    width: min(61vw, 506px);
    max-width: min(61vw, 506px);
    color: var(--think-body);
    text-align: left;
    animation: pop .24s cubic-bezier(.2,.8,.2,1) both;
  }
  .think-block.open{
    width: 100%;
    max-width: min(100%, 760px);
    text-align: center;
  }
  .think-toggle{
    appearance: none;
    -webkit-appearance: none;
    width: auto;
    max-width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
  }
  .think-block.open .think-toggle{
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(9px, 1.8vw, 14px);
  }
  .think-toggle:hover .think-caption{ color: var(--accent); }
  .think-toggle:active{ transform: translateY(1px); }
  .think-rule{
    display: none;
    position: relative;
    width: 100%;
    height: 1px;
    color: var(--think-flourish);
  }
  .think-block.open .think-rule{ display: block; }
  .think-rule::before{
    content: "";
    position: absolute;
    left: clamp(22px, 6vw, 64px);
    right: clamp(22px, 6vw, 64px);
    top: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--think-flourish) 16%, var(--think-flourish) 84%, transparent);
    opacity: .46;
  }
  .think-caption{
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    color: var(--think-label);
    font-family: var(--font-en), var(--font-cn);
    font-size: clamp(12px, 1.38vw, 14px);
    line-height: 1.1;
    letter-spacing: .08em;
    transition: color var(--motion-fast) var(--ease-soft);
  }
  .think-caption-star,
  .think-state{
    color: var(--think-flourish);
    font-size: 1.18em;
    line-height: 1;
    transform: translateY(-.02em);
  }
  .think-block.open .think-caption-star{ display: none; }
  .think-state::before{ content: "✧"; }
  .think-block.open .think-state::before{ content: "✦"; }
  .think-body[hidden]{ display: none !important; }
  .think-body{
    margin-top: clamp(12px, 2.2vw, 20px);
  }
  .think-text{
    width: min(82%, 520px);
    margin: 0 auto clamp(16px, 2.6vw, 24px);
    color: var(--think-body);
    font-family: var(--font-cn);
    font-size: clamp(12px, 1.25vw, 13.5px);
    line-height: 1.72;
    text-align: center;
    white-space: normal;
    overflow-wrap: break-word;
  }
  .think-starline{
    position: relative;
    width: 100%;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--think-flourish);
  }
  .think-starline::before,
  .think-starline::after{
    content: "";
    position: absolute;
    top: 50%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--think-flourish) 15%, var(--think-flourish) 85%, transparent);
    opacity: .5;
  }
  .think-starline::before{ left: 0; right: calc(50% + 34px); }
  .think-starline::after{ left: calc(50% + 34px); right: 0; }
  .think-star{
    position: relative;
    z-index: 1;
    color: var(--think-flourish);
    display: grid;
    place-items: center;
  }
  .think-star svg{ width: 24px; height: 24px; display: block; }
  .think-copy{ min-width: 0; }
  .think-copy a{ color: inherit; text-decoration: underline; text-underline-offset: 2px; }
  .think-copy code{
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: .9em;
    background: rgba(120,100,80,0.10);
    padding: 1px 5px;
    border-radius: 5px;
  }

  /* ── act ── the AI's action chip: a quiet "what it just did", optionally expand to see raw tool calls ──
     视觉与 thinking 同一族(--think-* 配色),但更小、更收,贴在头像缝隙里,不抢气泡 ── */
  .row.act{
    justify-content: flex-start;
    padding-left: calc(var(--avatar-size) + clamp(10px, 1.6vw, 16px));
    padding-right: clamp(12px, 4vw, 40px);
    margin-top: clamp(4px, 0.9vw, 9px);
    margin-bottom: clamp(4px, 0.9vw, 9px);
  }
  .act-block{
    max-width: min(80vw, 470px);
    animation: pop .24s cubic-bezier(.2,.8,.2,1) both;
  }
  .act-toggle{
    appearance: none; -webkit-appearance: none;
    margin: 0; padding: 2px 0; border: 0; background: transparent;
    color: inherit; font: inherit; cursor: pointer; text-align: left;
    max-width: 100%;
    display: inline-flex; align-items: baseline; gap: 7px;
  }
  .act-toggle.bare{ cursor: default; }
  .act-toggle:focus-visible{ outline: none; }
  .act-glyph{
    flex: none;
    color: var(--think-flourish);
    font-size: 1.04em; line-height: 1;
    transform: translateY(.06em);
  }
  .act-label{
    color: var(--think-label);
    font-family: var(--font-cn);                /* 统一宋体:--font-en 末尾的通用 serif 会先吃掉 CJK→iOS 回退黑体 */
    font-size: clamp(12px, 1.32vw, 13.5px);
    line-height: 1.46;
    letter-spacing: .02em;
  }
  /* 展开指示:沿用 thinking 的空心星 ✧(收起)→ 实心 ✦(展开),比"· 展开"文字更轻、不突兀 */
  .act-state{
    flex: none;
    color: var(--think-flourish);
    font-size: 1.1em;
    line-height: 1;
    transform: translateY(.02em);
    transition: color var(--motion-fast) var(--ease-soft);
  }
  .act-state::before{ content: "✧"; }
  .act-block.open .act-state::before{ content: "✦"; }
  .act-toggle:hover .act-state{ color: var(--accent); }
  .act-toggle:hover .act-label{ color: var(--think-body); }
  .act-toggle:active{ transform: translateY(1px); }
  .act-detail[hidden]{ display: none !important; }
  .act-detail{
    margin-top: 8px;
    border-radius: 12px;
    background: rgba(127,127,127,0.08);
    border: 1px solid var(--field-line);
    padding: clamp(9px, 1.6vw, 13px) clamp(11px, 1.8vw, 14px);
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 12px; line-height: 1.6;
    color: var(--think-body);
    overflow-x: auto;
    animation: pop .2s cubic-bezier(.2,.8,.2,1) both;
  }
  .act-step + .act-step{
    margin-top: 7px; padding-top: 7px;
    border-top: 1px dashed var(--field-line);
  }
  .act-line{ white-space: pre-wrap; overflow-wrap: anywhere; }
  .act-k{ color: var(--text-faint); user-select: none; }
  .act-v{ color: var(--think-body); }


  /* ── Composer ── */
  .composer{
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    width: min(100vw, var(--ref-width));
    margin: 0 auto;
    display:flex; align-items:center; gap: clamp(6px, 1vw, 12px);
    background: transparent; border:none;
    padding: 0 var(--side-pad) clamp(10px, 1.6vw, 18px);
    padding-bottom: calc(clamp(10px, 1.6vw, 18px) + env(safe-area-inset-bottom));
    transform: translate3d(0, calc(-1 * var(--keyboard-offset)), 0);
    -webkit-transform: translate3d(0, calc(-1 * var(--keyboard-offset)), 0);
    transition: transform .28s cubic-bezier(.2,.8,.2,1);
  }
  .floatbtn{
    flex:none; width: clamp(36px, 5vw, 48px); height: clamp(36px, 5vw, 48px); border-radius:50%;
    border: none; background: transparent;
    color: var(--accent); display:grid; place-items:center; cursor:pointer; padding:0;
    transition: transform .15s ease, color .2s ease;
  }
  .floatbtn:active{ transform: scale(.9); color: var(--text); }
  .floatbtn:hover{ color: var(--text); }
  .floatbtn svg{ width: clamp(20px, 2.8vw, 28px); height: clamp(20px, 2.8vw, 28px); display:block; }
  .floatbtn.send{
    background: var(--send-bg);
    color:#ffffff;
    box-shadow: 0 16px 32px rgba(41, 60, 78, 0.22);
  }
  .floatbtn.send:hover{ color:#ffffff; }
  .floatbtn.send:active{ transform: scale(.97); }      /* 发送键按压:轻收 3%(比通用 .floatbtn 的 .9 克制) */
  @keyframes send-go{ from{ transform: scale(.96); } to{ transform: scale(1); } }
  .floatbtn.send.send-go{ animation: send-go .22s cubic-bezier(.2,.8,.2,1); }
  @media (prefers-reduced-motion: reduce){ .floatbtn.send.send-go{ animation: none; } }
  .composer .field{
    flex:1 1 auto; display:flex; align-items:center; gap: clamp(4px, 0.8vw, 10px);
    background: var(--field-bg);
    border: 1px solid var(--field-line);
    border-radius: 999px;
    padding: clamp(4px, 0.6vw, 8px) clamp(8px, 1.2vw, 14px) clamp(4px, 0.6vw, 8px) clamp(10px, 1.5vw, 16px);
    min-height: clamp(42px, 5.5vw, 56px);
    box-shadow: var(--shadow);
    transition: border-color .2s ease;
  }
  .composer .field:focus-within{ border-color: var(--field-line); }
  .composer textarea:focus,
  .composer textarea:focus-visible,
  .composer button:focus-visible{
    outline: none;
  }
  textarea{
    flex:1 1 auto; border:none; outline:none; resize:none; background:transparent;
    color: var(--text); font-family: var(--font-en), var(--font-cn); font-size: clamp(15px, 2vw, 18px); line-height:1.35;
    max-height: 110px; padding: 6px 0; margin:0;
  }
  textarea::placeholder{ color: var(--text-faint); opacity: 1; }
  .emojibtn{
    flex:none; width: clamp(28px, 3.8vw, 38px); height: clamp(28px, 3.8vw, 38px); border:none; background:transparent;
    color: var(--accent); display:grid; place-items:center; cursor:pointer; padding:0;
    transition: transform .15s ease, color .2s ease;
  }
  .emojibtn:active{ transform: scale(.85); color: var(--text); }
  .emojibtn:hover{ color: var(--text); }
  .emojibtn svg{ width: clamp(22px, 3vw, 30px); height: clamp(22px, 3vw, 30px); display:block; }
  /* ── 回到最新 · 翻历史时来新消息,底部悬浮一枚安静的半透明胶囊 ── */
  .newmsg-pill{
    position: fixed; left: 50%; z-index: 90;
    bottom: calc(clamp(78px, 13vw, 96px) + env(safe-area-inset-bottom));
    display: inline-flex; align-items: center; gap: 5px;
    padding: 7px 14px 7px 11px; border: none; border-radius: 999px;
    background: rgba(34, 46, 60, .52); color: #fff;
    font-family: var(--font-en), var(--font-cn); font-size: 13px; line-height: 1; letter-spacing: .01em;
    -webkit-backdrop-filter: blur(10px) saturate(1.2); backdrop-filter: blur(10px) saturate(1.2);
    box-shadow: 0 8px 24px rgba(18, 28, 40, .26);
    cursor: pointer; opacity: 0; pointer-events: none;
    transform: translate3d(-50%, calc(8px - var(--keyboard-offset, 0px)), 0);
    transition: opacity .2s ease, transform .28s cubic-bezier(.2,.8,.2,1);
  }
  .newmsg-pill.show{ opacity: 1; pointer-events: auto; transform: translate3d(-50%, calc(-1 * var(--keyboard-offset, 0px)), 0); }
  .newmsg-pill svg{ width: 15px; height: 15px; flex: none; }
  @media (prefers-reduced-motion: reduce){ .newmsg-pill{ transition: opacity .2s ease; } }

  /* ── Login ── */
  .login{
    position: fixed; inset:0; z-index: 50;
    display:flex; flex-direction:column; align-items:center; justify-content:center;
    gap: 22px; padding: 28px;
    padding-top: calc(28px + env(safe-area-inset-top));
    background-color: var(--bg);
    background-image: var(--wall-default);
    background-size: cover;
    background-position: center;
  }
  .login .orb{
    width:72px; height:72px; border-radius:50%;
    background-image: var(--avatar-default);
    background-size: cover;
    box-shadow: 0 20px 42px rgba(24,46,67,0.2);
    animation: breathe 4.5s ease-in-out infinite;
  }
  .login h1{ margin:0; font-size:34px; font-weight:500; letter-spacing:0; }
  .login .sub{ margin:-12px 0 0; color: var(--text-soft); font-size:16px; text-align:center; }
  .login form{ display:flex; flex-direction:column; gap:11px; width:100%; max-width:320px; }
  .login input{
    width:100%; padding: 14px 16px; font: inherit; color: var(--text);
    background: var(--field-bg); border:1px solid var(--field-line); border-radius:18px; outline:none;
    transition: border-color .2s ease;
    box-shadow: var(--soft-shadow);
  }
  .login input:focus{ border-color: var(--accent); }
  .login button{
    width:100%; padding: 14px; font: inherit; font-weight:600;
    background: var(--accent); color: var(--accent-fg); border:none; border-radius:18px; cursor:pointer;
  }
  .login button:active{ transform: scale(.99); }
  .login .err{ color:#c0533f; font-size:13px; min-height:16px; text-align:center; margin:0; }
  .hidden{ display:none !important; }
  .app.kb .composer{ padding-bottom: 8px; }

  /* ── Profile page (full-screen settings) ── */
  .profile-panel{
    position: fixed;
    inset: 0;
    z-index: 200;
    pointer-events: none;
    transform: translateX(100%);
    opacity: 0;
    transition: transform .34s var(--ease-soft), opacity .26s ease;
  }
  .profile-panel.open{ transform: none; opacity: 1; pointer-events: auto; }
  /* own wallpaper layer so the chat behind is fully covered, theme-matched */
  .profile-page{
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    background-color: var(--bg);
    background-image: var(--wall-default);
    background-size: cover;
    background-position: center;
    overflow: hidden;
  }
  .profile-page::before{
    content:""; position:absolute; inset:0; background: var(--scrim); pointer-events:none;
  }
  .profile-topbar{
    position: relative; z-index:1;
    flex: 0 0 auto;
    display:flex; align-items:center; gap:10px;
    height: calc(56px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) var(--side-pad) 0;
  }
  .profile-back{
    width:40px; height:40px; flex:none;
    border:0; border-radius:50%; padding:0; margin-left:-6px;
    background: transparent; color: var(--text);
    display:grid; place-items:center; cursor:pointer;
    transition: transform .15s ease;
  }
  .profile-back:active{ transform: scale(.9); }
  .profile-back svg{ width:24px; height:24px; display:block; }
  .profile-scroll{
    position: relative; z-index:1;
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding: 10px var(--side-pad) calc(30px + env(safe-area-inset-bottom));
    display:flex; flex-direction:column; gap:24px;
  }
  .profile-scroll::-webkit-scrollbar{ width:0; height:0; }

  /* identity */
  .profile-identity{
    display:grid;
    grid-template-columns: auto 1fr;
    gap:18px; align-items:center;
    padding: 4px 4px 16px;
  }
  .profile-avatar{
    width:78px; height:78px; border-radius:50%;
    border:0; padding:0; overflow:hidden;
    -webkit-appearance:none; appearance:none;
    background-color:transparent;
    background-image: var(--avatar-default);
    background-size:cover; background-position:center;
    box-shadow: 0 12px 28px rgba(24,46,67,0.16);
    cursor:pointer; transition: transform .15s ease;
  }
  .profile-avatar:active{ transform: scale(.96); }
  .profile-id-copy{ min-width:0; }
  .profile-name-row{ display:flex; align-items:center; gap:9px; margin:0 0 5px; }
  .profile-name-row h3,
  #profileNameInput{
    margin:0;
    font-family: var(--font-en), var(--font-cn);
    font-size:23px; font-weight:500; letter-spacing:0;
    color: var(--text); line-height:1.1;
  }
  #profileNameInput{
    width:6.6em; max-width:62%;
    border:0; border-radius:10px;
    background: var(--seg-track); outline:none;
    padding:3px 11px; margin:-3px 0;
  }
  .profile-name-edit{
    width:26px; height:26px; flex:none;
    border:0; border-radius:50%; padding:0;
    background:transparent; color: var(--text-soft);
    display:grid; place-items:center; cursor:pointer;
    transition: color .2s ease, transform .15s ease;
  }
  .profile-name-edit:active{ transform: scale(.88); }
  .profile-name-edit svg{ width:15px; height:15px; display:block; }
  .profile-handle{
    display:flex; align-items:center; gap:7px; margin:0 0 8px;
    color: var(--text-soft);
    font-family: var(--font-en), var(--font-cn); font-size:13.5px;
  }
  .profile-bio{ margin:0; color: var(--text-soft); font-size:13px; line-height:1.55; }

  /* setting card */
  .settings-card{
    background: var(--card-bg);
    border: 1px solid var(--card-line);
    border-radius:18px;
    box-shadow: var(--card-shadow);
    padding:15px 16px;
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
  }
  .settings-label{
    display:flex; align-items:center; gap:6px;
    color: var(--text-soft); font-size:12.5px;
    margin-bottom:11px; letter-spacing:.01em;
  }
  .info-i{
    width:14px; height:14px; flex:none; border-radius:50%;
    border:1px solid var(--info-ring); color: var(--text-faint);
    display:inline-grid; place-items:center;
    font-size:9px; font-style:normal; line-height:1;
    font-family: var(--font-en), var(--font-cn);
    cursor:help; user-select:none;
  }
  .push-hint{
    margin-top:9px; font-size:11.5px; line-height:1.55;
    color: var(--text-faint); letter-spacing:.01em;
  }

  /* segmented control */
  .segmented{
    display:grid; grid-auto-flow:column; grid-auto-columns:1fr;
    gap:3px; background: var(--seg-track);
    border-radius:13px; padding:3px;
  }
  .segmented button{
    border:0; background:transparent; color: var(--text-soft);
    border-radius:10px; padding:8px 3px;
    font: inherit; font-size: clamp(10.5px, 2.9vw, 12.5px);
    letter-spacing:0; white-space:nowrap; cursor:pointer;
    transition: background .22s ease, color .22s ease, box-shadow .22s ease;
  }
  .segmented button.active{
    background: var(--seg-thumb); color: var(--text);
    box-shadow: var(--seg-thumb-shadow); font-weight:500;
  }

  /* context slider */
  .context-slider-wrap{ padding:4px 2px 2px; }
  .context-slider{
    -webkit-appearance:none; appearance:none;
    width:100%; height:4px; border-radius:999px;
    background: var(--slider-track);
    outline:none; cursor:pointer; margin:6px 0;
  }
  .context-slider::-webkit-slider-thumb{
    -webkit-appearance:none; appearance:none;
    width:21px; height:21px; border-radius:50%;
    background: var(--slider-thumb);
    border:2.5px solid var(--card-bg);
    box-shadow: 0 3px 10px rgba(24,46,67,.26); cursor:pointer;
  }
  .context-slider::-moz-range-thumb{
    width:21px; height:21px; border-radius:50%;
    background: var(--slider-thumb);
    border:2.5px solid var(--card-bg);
    box-shadow: 0 3px 10px rgba(24,46,67,.26); cursor:pointer;
  }
  .context-scale{
    display:flex; justify-content:space-between; margin-top:9px;
    color: var(--text-faint);
    font-family: var(--font-en), var(--font-cn); font-size:11.5px;
  }

  /* action rows */
  .action-row{
    display:flex; align-items:center; gap:13px;
    width:100%; text-align:left;
    background: var(--card-bg);
    border:1px solid var(--card-line);
    border-radius:16px; box-shadow: var(--card-shadow);
    padding:13px 16px; color: var(--text); font: inherit; cursor:pointer;
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    transition: background .18s ease, transform .12s ease;
  }
  button.action-row:active{ background: var(--row-press); transform: scale(.992); }
  .action-icon{ width:21px; height:21px; flex:none; color: var(--accent); display:grid; place-items:center; }
  .action-icon svg{ width:19px; height:19px; display:block; }
  .action-name{ font-family: var(--font-en), var(--font-cn); font-size:14.5px; color: var(--text); flex:none; }
  .action-value{
    margin-left:auto; color: var(--text-soft); font-size:12.5px;
    text-align:right; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  }
  .action-chevron{ flex:none; color: var(--text-faint); display:grid; place-items:center; margin-left:2px; }
  .action-chevron svg{ width:16px; height:16px; display:block; }
  .action-row.status{ cursor:default; }
  .action-row.status .status-main{ margin-left:auto; display:flex; flex-direction:column; align-items:flex-end; gap:2px; min-width:0; }
  .status-used{ color: var(--text); font-family: var(--font-en), var(--font-cn); font-size:13px; }
  .status-sid{ display:flex; align-items:center; gap:6px; color: var(--text-faint); font-size:11.5px; font-family: ui-monospace, "SF Mono", Menlo, monospace; }
  .status-copy{
    width:24px; height:24px; flex:none; border:0; border-radius:8px; padding:0;
    background:transparent; color: var(--text-soft);
    display:grid; place-items:center; cursor:pointer;
    transition: color .2s ease, transform .15s ease;
  }
  .status-copy:active{ transform: scale(.85); }
  .status-copy svg{ width:15px; height:15px; display:block; }

  /* toast */
  .toast{
    position: fixed; left:50%; bottom: calc(40px + env(safe-area-inset-bottom));
    transform: translate(-50%, 12px); z-index:300;
    background: rgba(20,34,48,.92); color:#eef5fb; font-size:14px;
    padding:10px 18px; border-radius:999px;
    box-shadow: 0 14px 34px rgba(0,0,0,.28);
    opacity:0; pointer-events:none;
    transition: opacity .24s ease, transform .24s ease;
  }
  .toast.show{ opacity:1; transform: translate(-50%, 0); }

  @media (max-width: 520px){
    :root{
      --side-pad: 16px;
      --header-h: 56px;
      --avatar-size: 32px;
    }
    .peerpill{ padding: 0 44px; }
    .peerpill .name{ font-size: 18px; }
    .peerpill .status{ font-size: 12px; margin-top: 3px; }
    .backbtn{ left: 16px; top: calc(env(safe-area-inset-top) + 16px); width: 32px; height: 32px; }
    .backbtn svg{ width: 20px; height: 20px; }
    .header-actions{ right: 16px; top: calc(env(safe-area-inset-top) + 16px); gap: 26px; height:32px; }
    .topbtn{ width:32px; height:32px; }
    .topbtn svg{ width:22px; height:22px; }
    .topbtn.more svg{ width:20px; height:20px; }
    .avatar{ right: 16px; top: calc(env(safe-area-inset-top) + 16px); }
    .row{ margin-top: 18px; }
    .row.grouped{ margin-top: 8px; }
    .row.ai{ padding-left: 42px; }
    .bubble{ max-width: min(63vw, 520px); font-size: 13.5px; line-height: 1.56; padding: 8px 13px 8px; }
    .meta{ font-size: 11px; margin-left: 8px; }
    .day{ font-size: 12px; }
    .new-divider{ font-size: 12px; margin: 14px 0 10px; }
    .composer{ gap: 5px; padding-left: 16px; padding-right: 16px; }
    .floatbtn{ width: 36px; height: 36px; }
    .floatbtn svg{ width: 20px; height: 20px; }
    .composer .field{ min-height: 42px; padding: 4px 8px 4px 12px; }
    textarea{ font-size: 15px; }
    .emojibtn{ width: 28px; height: 28px; }
    .emojibtn svg{ width: 22px; height: 22px; }
    .row.think{ padding-left: 42px; padding-right: 0; }
    .think-block{ width: min(63vw, 520px); max-width: min(63vw, 520px); }
    .think-block.open{ width: 100%; max-width: 100%; }
    .row.think.think-open{ padding-left: 0; padding-right: 0; }
    .think-caption{ font-size: 12.5px; letter-spacing: .07em; }
    .think-caption-star, .think-state{ font-size: 1.2em; }
    .think-body{ margin-top: 12px; }
    .think-text{ width: min(86%, 360px); font-size: 12px; line-height: 1.66; }
    .think-star svg{ width: 22px; height: 22px; }
    .profile-identity{ gap:15px; padding-bottom:14px; }
    .profile-avatar{ width:72px; height:72px; }
    .profile-name-row h3, #profileNameInput{ font-size:21px; }
    .profile-handle{ font-size:13px; }
    .profile-bio{ font-size:12.5px; }
    .settings-card{ padding:14px 15px; }
    .action-row{ padding:12px 15px; }
    .profile-scroll{ gap:22px; }
  }

  /* ── Menu (hub / home page · 从聊天页左箭头进入) ── */
  .menu-panel{
    position: fixed; inset: 0; z-index: 190;
    pointer-events: none;
    transform: translateX(-100%);
    opacity: 0;
    transition: transform .38s var(--ease-soft), opacity .28s ease;
  }
  .menu-panel.open{ transform: none; opacity: 1; pointer-events: auto; }
  .menu-page{
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    background-color: var(--bg);
    background-image: var(--menu-wall-default);
    background-size: cover; background-position: center;
    overflow: hidden;
  }
  .menu-page::before{
    content:""; position:absolute; inset:0; background: var(--scrim); pointer-events:none;
  }
  .menu-scroll{
    position: relative; z-index: 1;
    flex: 1 1 auto; overflow-y: auto;
    -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
    display: flex; flex-direction: column;
    padding: calc(env(safe-area-inset-top) + clamp(18px, 4vw, 30px)) clamp(26px, 7vw, 54px) calc(env(safe-area-inset-bottom) + clamp(20px, 5vw, 30px));
  }
  .menu-scroll::-webkit-scrollbar{ width:0; height:0; }

  /* header: 玻璃液态日夜 toggle(左) · PRIVATE SPACE(右) */
  .menu-head{
    flex: 0 0 auto;
    display:flex; align-items:flex-start; justify-content:space-between;
    margin-bottom: clamp(34px, 10vw, 68px);
  }
  /* (主题切换已移至设置页 #themeSeg;原菜单页玻璃 toggle 的 CSS 已随标记一并移除) */
  .menu-private{
    text-align:right; line-height:1.55;
    font-family: var(--font-en), var(--font-cn);
    font-size: clamp(9.5px, 2.5vw, 11px); letter-spacing:.24em;
    color: var(--text-soft); text-transform:uppercase;
  }
  .menu-private::after{
    content:""; display:block; margin-left:auto; margin-top:8px;
    width: clamp(20px, 5.5vw, 26px); height:1px; background: var(--text-faint); opacity:.6;
  }

  /* hero: app title · since · days */
  .menu-hero{ flex: 0 0 auto; margin-bottom: clamp(38px, 11vw, 72px); }
  .menu-title{
    font-family: "Pinyon Script", var(--font-en), cursive;
    font-weight: 400;
    font-size: clamp(46px, 15vw, 86px);
    line-height: 1.04;
    color: var(--text);
    margin: 0 0 clamp(16px, 4.4vw, 26px);
    letter-spacing: .005em;
    text-shadow: 0 2px 26px rgba(0,0,0,.16);
  }
  .menu-since{
    font-family: var(--font-en), var(--font-cn);
    font-size: clamp(11px, 2.9vw, 13.5px);
    letter-spacing:.14em; color: var(--text-soft);
    margin: 0 0 clamp(8px, 2.2vw, 12px);
  }
  .menu-days{
    display:flex; align-items:baseline; gap: clamp(8px, 2.6vw, 12px);
    font-family: var(--font-en), var(--font-cn); color: var(--text);
  }
  .menu-days .num{ font-size: clamp(30px, 8.4vw, 48px); font-weight:500; line-height:1; letter-spacing:.01em; }
  .menu-days .lab{ font-size: clamp(12px, 3.1vw, 15px); letter-spacing:.13em; color: var(--text-soft); }

  /* list */
  .menu-list{ flex: 0 0 auto; display:flex; flex-direction:column; }
  .menu-item{
    display:grid;
    grid-template-columns: clamp(22px, 6vw, 27px) auto 1fr auto;
    align-items:center; gap: clamp(12px, 3.4vw, 18px);
    width:100%; text-align:left;
    background:transparent; border:0;
    border-top:1px solid var(--hairline);
    padding: clamp(15px, 4.4vw, 21px) 2px;
    color: var(--text); font: inherit; cursor:pointer;
    transition: background .18s ease, transform .12s ease;
  }
  .menu-item:last-child{ border-bottom:1px solid var(--hairline); }
  .menu-item:active{ background: var(--row-press); transform: scale(.995); }
  .menu-ic{ display:grid; place-items:center; color: var(--text-soft); }
  .menu-ic svg{ width: clamp(19px, 5vw, 22px); height: clamp(19px, 5vw, 22px); display:block; }
  .menu-dot{ width:3px; height:3px; border-radius:50%; background: var(--text-faint); opacity:.5; }
  .menu-copy{ display:flex; flex-direction:column; min-width:0; }
  .menu-name{
    font-family: var(--font-en), var(--font-cn);
    font-size: clamp(18px, 5vw, 23px); font-weight:500; line-height:1.14;
    color: var(--text); margin-bottom:2px;
  }
  .menu-sub{
    font-family: var(--font-en), var(--font-cn);
    font-size: clamp(8.5px, 2.3vw, 10px); letter-spacing:.16em;
    text-transform:uppercase; color: var(--text-faint);
  }
  .menu-chev{ color: var(--text-faint); display:grid; place-items:center; }
  .menu-chev svg{ width:15px; height:15px; display:block; }

  /* footer */
  .menu-foot{
    flex: 1 1 auto;
    display:flex; align-items:flex-end; justify-content:center;
    text-align:center;
    padding-top: clamp(22px, 6vw, 40px);
    font-family: var(--font-en), var(--font-cn);
    font-size: clamp(10.5px, 2.7vw, 12.5px); font-style:italic;
    letter-spacing:.05em; color: var(--text-faint);
  }

  /* ── Voice call (speaking overlay · 假按键 / 纯 UI,后端以后接) ── */
  .call-overlay{
    position: fixed; inset: 0; z-index: 150;
    pointer-events: none;
  }
  .call-scrim{
    position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,.55) 0%, rgba(255,255,255,.25) 40%, rgba(255,255,255,.45) 100%);
    pointer-events: none;
    opacity: 0;
    transition: opacity .3s ease;
  }
  .call-overlay.open .call-scrim{ opacity: 1; }
  .call-sheet{
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center;
    justify-content: flex-start;
    padding: calc(env(safe-area-inset-top) + clamp(50px, 10vw, 84px)) var(--side-pad) calc(env(safe-area-inset-bottom) + 26px);
    text-align: center;
    background-color: var(--bg);
    background-image: var(--wall-default);
    background-size: cover; background-position: center;
    opacity: 0; pointer-events: none;
    transform: translateY(12px);
    transition: opacity .34s var(--ease-soft), transform .34s var(--ease-soft);
    overflow: hidden;
  }
  .call-overlay.open .call-sheet{ opacity: 1; pointer-events: auto; transform: translateY(0); }

  /* ── Avatar stage: 头像 + 两翼声纹 ── */
  .call-avatar-stage{
    display: flex; align-items: center; justify-content: center;
    width: 100%;
    gap: clamp(8px, 2.2vw, 16px);
    margin-top: clamp(4px, 3vh, 30px);
    flex-shrink: 0;
  }
  .call-vu{
    --vu-level: 0;
    flex: 1 1 0; min-width: 0;
    height: clamp(70px, 17vw, 100px);
    display: flex; align-items: center;
    gap: clamp(2.5px, 0.8vw, 4px);
  }
  .call-vu-left{ flex-direction: row-reverse; }
  .call-vu i{
    flex: 0 0 auto;
    width: clamp(2px, 0.65vw, 3px);
    height: calc(100% * var(--bar, .4) * (0.46 + 0.54 * var(--vu-level)));
    min-height: 2px;
    border-radius: 99px;
    background: var(--accent);
    opacity: calc(var(--bar-op, .4) * (0.6 + 0.4 * var(--vu-level)));
    animation: callVuIdle var(--vu-dur, 1.6s) var(--ease-soft) infinite alternate;
    animation-delay: var(--vu-delay, 0s);
    will-change: transform, opacity;
  }
  @keyframes callVuIdle{ from{ transform: scaleY(.55); } to{ transform: scaleY(1); } }
  @media (prefers-reduced-motion: reduce){ .call-vu i{ animation: none; } }

  /* ── Avatar ring ── */
  .call-avatar-ring{
    --ring-level: 0;
    position: relative;
    width: clamp(128px, 37vw, 168px); height: clamp(128px, 37vw, 168px);
    border-radius: 50%;
    display: grid; place-items: center;
    flex: 0 0 auto;
    box-shadow:
      0 10px 34px rgba(40,60,78,.16),
      0 0 calc(16px + 34px * var(--ring-level)) calc(2px + 12px * var(--ring-level)) color-mix(in srgb, var(--accent) 30%, transparent);
    transition: box-shadow .14s ease;
  }
  .call-avatar-img{
    width: 100%; height: 100%;
    border-radius: 50%;
    background-image: var(--avatar-default);
    background-size: cover; background-position: center;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);
  }

  /* ── Name / status / timer ── */
  .call-name{
    margin-top: clamp(18px, 4vw, 28px);
    color: var(--text);
    font-family: var(--font-cn);
    font-size: clamp(27px, 7vw, 36px);
    font-weight: 500;
    line-height: 1.2;
  }
  .call-status{
    display: inline-flex; align-items: center; gap: 11px;
    color: var(--think-label);
    font-family: var(--font-en), var(--font-cn);
    font-size: clamp(13px, 1.8vw, 15.5px);
    letter-spacing: .16em;
    line-height: 1;
    margin-top: 8px;
  }
  .call-status .call-star{ color: var(--think-flourish); display: grid; place-items: center; }
  .call-status .call-star svg{ width: 16px; height: 16px; display: block; }
  .call-timer{
    font-family: var(--font-en), var(--font-cn);
    font-variant-numeric: tabular-nums;
    font-size: clamp(19px, 5vw, 25px);
    font-weight: 500;
    letter-spacing: .04em;
    line-height: 1;
    color: var(--text-soft);
    margin-top: 9px;
  }

  /* ── Quote (the AI's last spoken line) ── */
  .call-quote{
    flex: 1 1 auto;
    min-height: 0;                 /* 让 flex 能真正约束它,长文本不再撑破/盖住头像与字幕 */
    display: flex; align-items: center; justify-content: center;
    width: min(88vw, 400px);
    padding: clamp(8px, 2vw, 18px) clamp(8px, 2vw, 16px);
    overflow: hidden;              /* 兜底:绝不溢出到相邻区域 */
  }
  .call-quote-mark{
    color: var(--text-faint);
    font-family: var(--font-en);
    font-size: clamp(40px, 9.5vw, 56px);
    line-height: 1;
    user-select: none;
    flex-shrink: 0;
    align-self: flex-start;
    opacity: .5;
  }
  .call-quote-mark:last-child{ align-self: flex-end; }
  .call-quote-text{
    max-height: 100%;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;                 /* Firefox 隐藏滚动条 */
    color: var(--text);
    font-family: var(--font-cn);
    font-size: clamp(20px, 5.2vw, 27px);
    line-height: 1.52;
    text-align: center;
    padding: 0 clamp(6px, 1.5vw, 12px);
    overflow-wrap: break-word;
  }
  .call-quote-text::-webkit-scrollbar{ display: none; }   /* WebKit 隐藏滚动条 */
  /* 仅当文字真的溢出时(由 JS 加 .clip)才底部渐隐(顶部保持清晰,因为总是从头读起,
     渐隐只用来暗示"下面还有,全文在字幕条里") */
  .call-quote-text.clip{
    -webkit-mask-image: linear-gradient(180deg, #000 0, #000 calc(100% - 22px), transparent 100%);
            mask-image: linear-gradient(180deg, #000 0, #000 calc(100% - 22px), transparent 100%);
  }
  .call-quote-text.hint{
    color: var(--text-soft);
    font-size: clamp(18px, 4.8vw, 24px);
  }
  .call-quote-text.lyric-mode{
    font-size: clamp(14px, 3.8vw, 19px);
    text-align: center;
  }
  .lyric-line{
    display: block;
    opacity: 0.28;
    transition: opacity 0.45s ease, transform 0.45s ease;
    transform: scale(0.96);
    padding: 3px 0;
  }
  .lyric-line.active{
    opacity: 1;
    transform: scale(1);
  }

  /* ── Transcript section ── */
  .call-transcript-section{
    width: min(92vw, 440px);
    display: flex; flex-direction: column; align-items: center;
    gap: 10px;
    flex-shrink: 0;
  }
  .call-transcript-label{
    position: relative;
    display: flex; align-items: center; justify-content: center;
    width: 100%;
    color: var(--text-faint);
    font-family: var(--font-en), var(--font-cn);
    font-size: clamp(12px, 1.5vw, 13px);
    letter-spacing: .06em;
  }
  .call-transcript-cap{ display: inline-flex; align-items: center; gap: 7px; }
  .call-transcript-cap::before{
    content: ""; display: inline-block;
    width: 16px; height: 14px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round'%3E%3Cline x1='4' y1='9' x2='4' y2='15'/%3E%3Cline x1='9' y1='4.5' x2='9' y2='19.5'/%3E%3Cline x1='14' y1='7.5' x2='14' y2='16.5'/%3E%3Cline x1='19' y1='10.5' x2='19' y2='13.5'/%3E%3C/svg%3E") center/contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round'%3E%3Cline x1='4' y1='9' x2='4' y2='15'/%3E%3Cline x1='9' y1='4.5' x2='9' y2='19.5'/%3E%3Cline x1='14' y1='7.5' x2='14' y2='16.5'/%3E%3Cline x1='19' y1='10.5' x2='19' y2='13.5'/%3E%3C/svg%3E") center/contain no-repeat;
  }
  /* 「我在想 …」跳动点(引号区,贴心提示) */
  .call-dots{ display: inline-flex; align-items: center; gap: 4px; }
  .call-dots i{
    width: 4px; height: 4px; border-radius: 50%;
    background: currentColor;
    animation: callTypingDot 1.25s ease-in-out infinite;
  }
  .call-dots i:nth-child(2){ animation-delay: .16s; }
  .call-dots i:nth-child(3){ animation-delay: .32s; }
  @keyframes callTypingDot{ 0%,70%,100%{ transform: translateY(0); opacity:.4; } 35%{ transform: translateY(-3px); opacity:1; } }
  .call-dots-quote{ margin-left: 10px; vertical-align: middle; gap: 5px; }
  .call-dots-quote i{ width: 6px; height: 6px; }
  .call-transcript-bar{
    width: 100%;
    min-height: 2em;
    padding: clamp(11px, 2.2vw, 15px) clamp(18px, 4vw, 26px);
    border-radius: clamp(18px, 3.4vw, 24px);
    background: linear-gradient(157deg, var(--call-glass-top), var(--call-glass-bot));
    border: 1px solid var(--call-glass-edge);
    box-shadow: var(--call-glass-shadow), inset 0 1px 0 var(--call-glass-hi);
    -webkit-backdrop-filter: blur(24px) saturate(1.6);
    backdrop-filter: blur(24px) saturate(1.6);
    color: var(--text);
    font-family: var(--font-cn);
    font-size: clamp(14.5px, 2vw, 16.5px);
    line-height: 1.6;
    text-align: center;
    overflow-wrap: break-word;
    max-height: clamp(72px, 16vh, 132px);   /* 长字幕也封顶,不再把控制键/挂断顶出屏外 */
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: none;
  }
  .call-transcript-bar::-webkit-scrollbar{ display: none; }
  .call-transcript-bar .caret{
    display: inline-block; width: 1px; height: 1.04em; margin-left: 2px;
    background: currentColor; opacity: .55;
    vertical-align: -0.14em;
    animation: callCaret 1s steps(1) infinite;
  }
  @keyframes callCaret{ 0%,49%{ opacity:.55; } 50%,100%{ opacity:0; } }

  /* ── Controls row ── */
  .call-controls{
    display: flex; align-items: flex-start; justify-content: center;
    gap: clamp(30px, 9vw, 50px);
    margin-top: clamp(22px, 4vw, 34px);
    flex-shrink: 0;
  }
  .call-ctrl-btn{
    display: flex; flex-direction: column; align-items: center; gap: 9px;
    border: 0; padding: 0; cursor: pointer;
    background: transparent;
    color: var(--text-soft);
    -webkit-tap-highlight-color: transparent;
  }
  .call-ctrl-btn > svg{
    width: clamp(58px, 14.5vw, 70px); height: clamp(58px, 14.5vw, 70px);
    padding: clamp(15px, 3.4vw, 19px);
    border-radius: 50%;
    background: linear-gradient(157deg, var(--call-glass-top), var(--call-glass-bot));
    border: 1px solid var(--call-glass-edge);
    -webkit-backdrop-filter: blur(20px) saturate(1.6);
    backdrop-filter: blur(20px) saturate(1.6);
    box-shadow: 0 8px 22px rgba(40,60,78,.10), inset 0 1px 0 var(--call-glass-hi);
    transition: background .15s ease, transform .12s ease, color .15s ease;
  }
  .call-ctrl-btn:active > svg{ transform: scale(.92); }
  .call-ctrl-btn > span{
    font-family: var(--font-cn);
    font-size: clamp(12px, 1.6vw, 13.5px);
    color: var(--text-faint);
  }
  .call-ctrl-btn.active > svg{
    background: var(--accent);
    color: var(--accent-fg);
    border-color: transparent;
  }

  /* ── Hangup ── */
  .call-hangup{
    margin-top: clamp(20px, 4vw, 32px);
    width: clamp(64px, 15.5vw, 74px); height: clamp(64px, 15.5vw, 74px);
    border: 0; border-radius: 50%; padding: 0; cursor: pointer;
    background: var(--call-hangup-bg);
    color: #fff;
    display: grid; place-items: center;
    box-shadow: 0 10px 26px var(--call-hangup-shadow);
    transition: transform .15s ease, filter .2s ease;
    flex-shrink: 0;
  }
  .call-hangup:hover{ filter: brightness(1.05); }
  .call-hangup:active{ transform: scale(.92); }
  .call-hangup svg{ width: clamp(26px, 5.6vw, 31px); height: clamp(26px, 5.6vw, 31px); display: block; transform: rotate(135deg); }

  /* ── Minimize (top-left) ── */
  .call-minimize-top{
    position: absolute;
    top: calc(env(safe-area-inset-top) + clamp(10px, 2vw, 16px));
    left: clamp(10px, 2vw, 16px);
    width: 36px; height: 36px;
    border: 0; border-radius: 50%; padding: 0; cursor: pointer;
    background: var(--card-bg);
    border: 1px solid var(--card-line);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    color: var(--text-soft);
    display: grid; place-items: center;
    z-index: 2;
    -webkit-tap-highlight-color: transparent;
    transition: background .15s ease, transform .12s ease;
  }
  .call-minimize-top:active{ transform: scale(.9); }
  .call-minimize-top svg{ width: 18px; height: 18px; display: block; }

  /* ── Hide old wave (no longer visible) ── */
  .call-wave{ display: none; }

  /* ── Call mini-bar (WeChat-style green strip) ── */
  .call-mini{
    display: none;
    position: fixed;
    left: 0; right: 0;
    top: calc(var(--header-h) + env(safe-area-inset-top));
    height: 34px;
    background: var(--accent);
    color: var(--accent-fg);
    font-family: var(--font-cn);
    font-size: 13px;
    align-items: center; justify-content: center;
    gap: 8px;
    z-index: 152;
    cursor: pointer;
    pointer-events: auto;
    -webkit-tap-highlight-color: transparent;
    transition: opacity .2s ease;
  }
  .call-mini:active{ filter: brightness(.88); }
  .call-mini-dot{
    width: 7px; height: 7px;
    border-radius: 50%;
    background: currentColor;
    animation: callMiniPulse 1.4s ease-in-out infinite;
  }
  @keyframes callMiniPulse{
    0%,100%{ opacity: 1; }
    50%{ opacity: .35; }
  }
  .call-mini-timer{
    font-family: var(--font-en);
    font-variant-numeric: tabular-nums;
    letter-spacing: .04em;
  }
  .call-overlay.open.minimized .call-scrim{ opacity: 0; pointer-events: none; }
  .call-overlay.open.minimized .call-sheet{ opacity: 0; pointer-events: none; transform: translateY(12px); }
  .call-overlay.open.minimized .call-mini{ display: flex; }
  .call-overlay.open.minimized{ pointer-events: none; }

  /* 来电:全屏(与通话中同一张画布,接听后无缝衔接,不再是顶部小卡片) */
  .incoming-call-overlay{ z-index: 151; }
  .incoming-call-overlay .call-scrim{ background: var(--call-scrim); }
  .incoming-call-overlay .call-sheet{
    justify-content: flex-start;
    gap: clamp(12px, 2.6vw, 20px);
  }
  /* caption 行(✦ incoming call ✦)——与 .call-status 同款横排 */
  .call-caption{
    display: inline-flex; align-items: center; gap: 11px;
    color: var(--think-label);
    font-family: var(--font-en), var(--font-cn);
    font-size: clamp(13px, 1.8vw, 15.5px);
    letter-spacing: .16em; line-height: 1;
    margin-top: clamp(2px, 2vh, 14px);
  }
  .call-caption .call-star{ color: var(--think-flourish); display: grid; place-items: center; }
  .call-caption .call-star svg{ width: 16px; height: 16px; display: block; }
  /* 来电大头像 + 呼吸光环 */
  .incoming-call-avatar{
    width: clamp(132px, 40vw, 184px); height: clamp(132px, 40vw, 184px);
    border-radius: 50%;
    background-image: var(--avatar-default);
    background-size: cover; background-position: center;
    box-shadow: 0 12px 38px rgba(40,60,78,.18), inset 0 0 0 1px rgba(255,255,255,.14);
    margin-top: clamp(10px, 4vh, 36px);
    animation: incomingPulse 2.4s var(--ease-soft) infinite;
  }
  @keyframes incomingPulse{
    0%   { box-shadow: 0 12px 38px rgba(40,60,78,.18), 0 0 0 0 color-mix(in srgb, var(--accent) 34%, transparent), inset 0 0 0 1px rgba(255,255,255,.14); }
    70%  { box-shadow: 0 12px 38px rgba(40,60,78,.18), 0 0 0 22px color-mix(in srgb, var(--accent) 0%, transparent), inset 0 0 0 1px rgba(255,255,255,.14); }
    100% { box-shadow: 0 12px 38px rgba(40,60,78,.18), 0 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent), inset 0 0 0 1px rgba(255,255,255,.14); }
  }
  @media (prefers-reduced-motion: reduce){ .incoming-call-avatar{ animation: none; } }
  /* 来电动作区:推到底部,拒接/接听左右分开(iOS 式) */
  .incoming-call-actions{
    margin-top: auto;
    margin-bottom: calc(env(safe-area-inset-bottom) + clamp(14px, 5vh, 52px));
    display: flex; align-items: flex-end; justify-content: center;
    gap: clamp(46px, 22vw, 108px);
    width: 100%;
  }
  .incoming-call-slot{ display: flex; flex-direction: column; align-items: center; gap: 11px; }
  .incoming-call-label{
    font-family: var(--font-cn);
    font-size: clamp(12px, 1.6vw, 13.5px);
    color: var(--text-faint);
  }
  .incoming-call-title{
    margin-top: clamp(4px, 2vw, 12px);
    color: var(--text);
    font-family: var(--font-cn);
    font-size: clamp(27px, 6.6vw, 36px);
    line-height: 1.2;
    font-weight: 500;
  }
  .incoming-call-text{
    width: min(80vw, 360px);
    min-height: 1.6em;
    color: var(--text-soft);
    font-family: var(--font-cn);
    font-size: clamp(14px, 1.9vw, 16px);
    line-height: 1.6;
    text-align: center;
    overflow-wrap: break-word;
  }
  .incoming-call-actions{
    display: flex; align-items: center; justify-content: center;
    gap: clamp(18px, 6vw, 34px);
    width: 100%;
  }
  .incoming-call-btn{
    width: clamp(62px, 15.5vw, 74px); height: clamp(62px, 15.5vw, 74px);
    border: 0; border-radius: 50%; padding: 0; cursor: pointer;
    color: #fff;
    display: grid; place-items: center;
    transition: transform .15s ease, filter .2s ease;
  }
  .incoming-call-btn:hover{ filter: brightness(1.05); }
  .incoming-call-btn:active{ transform: scale(.92); }
  .incoming-call-btn svg{ width: clamp(26px, 6vw, 30px); height: clamp(26px, 6vw, 30px); display: block; }
  .incoming-call-btn.accept{
    background: #5aa77a;
    box-shadow: 0 10px 26px rgba(69,132,96,.34);
  }
  .incoming-call-btn.decline{
    background: var(--call-hangup-bg);
    box-shadow: 0 10px 26px var(--call-hangup-shadow);
  }
  .incoming-call-btn.decline svg{ transform: rotate(135deg); }
  .topbtn.call.active{ color: var(--accent); }

  /* ── 长按气泡 · 复制菜单 (TG 式抬起+遮罩) ── */
  /* 长按由我们接管 → 彻底屏蔽聊天区(#scroll)的系统选择/放大镜/callout,否则和我们的菜单打架。
     用 !important 压过一切(含 iOS 误报 hover/pointer 的情况)。输入框在 #scroll 外,单独保持可选可编辑;
     气泡里要复制文字走长按菜单的 Copy。 */
  #scroll, #scroll *{
    -webkit-user-select:none !important; user-select:none !important;
    -webkit-touch-callout:none !important;
  }
  textarea, input, .composer, .composer *{
    -webkit-user-select:text !important; user-select:text !important;
    -webkit-touch-callout:default !important;
  }

  .msg-menu{ position:fixed; inset:0; z-index:250; opacity:0; pointer-events:none; }
  .msg-menu.open{ opacity:1; pointer-events:auto; }
  .msg-menu-scrim{
    position:absolute; inset:0;
    background:rgba(10,16,24,.30);
    -webkit-backdrop-filter:blur(4px); backdrop-filter:blur(4px);
    opacity:0; transition:opacity .26s var(--ease-soft);
  }
  .msg-menu.open .msg-menu-scrim{ opacity:1; }
  .msg-menu-clone{
    position:fixed !important; margin:0 !important; animation:none !important;
    pointer-events:none; box-sizing:border-box;
    box-shadow:0 22px 50px rgba(18,34,52,.30);
    transform:scale(1); transition:transform .26s var(--ease-soft); will-change:transform;
  }
  .msg-menu.open .msg-menu-clone{ transform:scale(1.02); }
  .msg-menu-clone.clone-human{ background:var(--bubble-human-bg) !important; color:var(--bubble-human-fg) !important; }
  .msg-menu-clone.clone-ai{ background:var(--bubble-ai-bg) !important; color:var(--bubble-ai-fg) !important; }
  .msg-menu-actions{
    position:fixed; display:flex; flex-direction:column; min-width:150px; padding:5px;
    border-radius:16px; background:var(--composer-bg); border:1px solid var(--hairline);
    box-shadow:var(--shadow);
    -webkit-backdrop-filter:blur(20px) saturate(1.4); backdrop-filter:blur(20px) saturate(1.4);
    opacity:0; transform:translateY(8px) scale(.96); transform-origin:top center;
    transition:opacity .2s var(--ease-soft) .05s, transform .26s var(--ease-soft) .05s;
  }
  .msg-menu.open .msg-menu-actions{ opacity:1; transform:none; }
  .msg-act{
    appearance:none; -webkit-appearance:none; border:0; background:transparent; color:var(--text);
    font-family:var(--font-en), var(--font-cn); font-size:15px; display:flex; align-items:center; gap:11px;
    padding:10px 14px; border-radius:12px; cursor:pointer; text-align:left; width:100%;
    transition:background var(--motion-fast);
  }
  .msg-act:hover{ background:var(--row-press); }
  .msg-act:active{ background:var(--row-press); transform:scale(.98); }
  .msg-act svg{ width:18px; height:18px; opacity:.82; flex:0 0 auto; }
  .msg-act.danger{ color:#e05a4d; }                       /* 删除(仅本地) */

  /* ── reaction chips (AI poke) ── */
  .row.has-reactions{ flex-direction:column; gap:5px; }
  .row.human.has-reactions{ align-items:flex-end; }
  .row.ai.has-reactions{ align-items:flex-start; }
  .reactions{ display:flex; flex-wrap:wrap; gap:5px; max-width:min(61vw,506px); }
  .reaction{
    display:inline-flex; align-items:center; justify-content:center;
    font-size:15px; line-height:1; padding:4px 9px; border-radius:13px;
    background:var(--bubble-ai-bg); border:1px solid var(--hairline);
    box-shadow:0 4px 12px rgba(78,94,108,.12);
    -webkit-user-select:none; user-select:none;
  }
  .reaction.pop-in{ animation:reactionPop .52s cubic-bezier(.34,1.56,.5,1) both; }
  @keyframes reactionPop{
    0%{ transform:scale(0) rotate(-16deg); opacity:0; }
    55%{ transform:scale(1.22) rotate(5deg); opacity:1; }
    100%{ transform:none; opacity:1; }
  }

  @media (prefers-reduced-motion: reduce){
    *,
    *::before,
    *::after{
      animation: none !important;
      transition-duration: 0.01ms !important;
      scroll-behavior: auto !important;
    }
    /* 通话声纹是"对方正在说话"的功能性反馈,即便系统减弱动态也保留(细窄低位移,不刺激) */
    .call-wave i{
      animation: callWave var(--dur, 1s) var(--ease-soft) var(--d, 0s) infinite alternate !important;
    }
  }
