/* 小手机 · iOS 26 风格（按 Claude Design 稿实现）
   结构：tokens → 基础 → 材质 → 视图与转场 → 桌面 → 页头/列表 → 微信 → 聊天 → 设置类 → 各 App → sheet/toast → 无障碍 */

/* ---------- tokens ---------- */
:root{
  color-scheme:light dark;
  --blue:#007AFF;--green:#34C759;--red:#FF3B30;--orange:#FF9500;--yellow:#FFCC00;--purple:#AF52DE;
  --green-t:#248A3D;--red-t:#D70015;--orange-t:#C93400;
  --bg:#F2F2F7;--card:#FFFFFF;--plain:#FFFFFF;
  --label:#000;--label2:rgba(60,60,67,.6);--label3:rgba(60,60,67,.3);--sep:rgba(60,60,67,.29);
  --fill:rgba(118,118,128,.12);--fill2:rgba(120,120,128,.2);--bubble:#E9E9EB;--tint:rgba(0,122,255,.12);
  --glass:rgba(255,255,255,.72);--glass-hi:#fff;--glass-lo:rgba(0,0,0,.07);--glass-rim:rgba(0,0,0,.06);
  --sheet:rgba(246,246,250,.86);--asbg:rgba(255,255,255,.85);
  --pagebg:var(--bg);--tab-cut:var(--card);--pin-bg:#E5E5EA;
  /* app.js 生成的内联样式还在用的旧名字 */
  --text:var(--label);--text2:var(--label2);
  --sat:env(safe-area-inset-top,0px);--sab:env(safe-area-inset-bottom,0px);
  --top:max(var(--sat),10px);
  --navh:calc(var(--top) + 62px);
  --ease:cubic-bezier(.32,.72,0,1);
}
@media (prefers-color-scheme:dark){
  :root{
    --blue:#0A84FF;--green:#30D158;--red:#FF453A;--orange:#FF9F0A;--yellow:#FFD60A;--purple:#BF5AF2;
    --green-t:#30D158;--red-t:#FF6961;--orange-t:#FF9F0A;
    --bg:#000;--card:#1C1C1E;--plain:#000;
    --label:#fff;--label2:rgba(235,235,245,.6);--label3:rgba(235,235,245,.3);--sep:rgba(84,84,88,.65);
    --fill:rgba(118,118,128,.24);--fill2:rgba(120,120,128,.36);--bubble:#26252A;--tint:rgba(10,132,255,.22);
    --glass:rgba(40,40,44,.62);--glass-hi:rgba(255,255,255,.2);--glass-lo:rgba(0,0,0,.5);--glass-rim:rgba(255,255,255,.07);
    --sheet:rgba(30,30,34,.86);--asbg:rgba(58,58,62,.7);--pin-bg:#1C1C1E;
  }
}

/* ---------- 基础 ---------- */
*{margin:0;padding:0;box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{height:100%}
html{background:var(--bg)}
body{position:relative;height:100dvh;max-width:480px;margin:0 auto;overflow:hidden;background:var(--bg);color:var(--label);
  font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text","SF Pro Display","PingFang SC","Helvetica Neue","Microsoft YaHei",sans-serif;
  font-size:17px;line-height:1.3;letter-spacing:-.2px;-webkit-font-smoothing:antialiased;-webkit-text-size-adjust:100%;
  -webkit-user-select:none;user-select:none}
@media (min-width:481px){body{box-shadow:0 0 0 .5px var(--sep)}}
input,textarea{font:inherit;color:inherit;-webkit-user-select:text;user-select:text}
button{font:inherit;color:inherit;border:0;background:none;cursor:pointer;-webkit-appearance:none;appearance:none;text-align:inherit}
svg{flex:none;display:block}
[hidden]{display:none!important}
:focus{outline:none}
:focus-visible{outline:2px solid var(--blue);outline-offset:2px}
.statusbar{display:none}
.nav-sp{flex:1}
.nav-sp44{width:44px;flex:none}

/* ---------- Liquid Glass ---------- */
.glass,#toast{background:var(--glass);-webkit-backdrop-filter:blur(24px) saturate(180%);backdrop-filter:blur(24px) saturate(180%);
  box-shadow:inset 0 .5px 0 var(--glass-hi),inset 0 -.5px 0 var(--glass-lo),0 0 0 .5px var(--glass-rim),0 6px 20px rgba(0,0,0,.1)}

/* ---------- 按压反馈 ---------- */
.app-icon,.btn,.back,.nav-btn,.ph-btn,.send,.plus,.like-btn,.v-opt,.wp-item,.lore-del,.wa-in,.wa-out,.tab{transition:transform .2s var(--ease),opacity .2s,background-color .2s,color .2s}
.app-icon:active,.btn:active,.back:active,.nav-btn:active,.ph-btn:active,.send:active,.plus:active,.like-btn:active,.v-opt:active,.wp-item:active,.lore-del:active,.wa-in:active,.wa-out:active,.tab:active{transform:scale(.95)}
.c-item,.menu-item,.cell.tap,.model-item{transition:background-color .2s}
.c-item:active,.menu-group .menu-item:active,.cell.tap:active,.model-item:active,#sheetContent>.menu-item:active{background-color:var(--fill)}

/* ---------- 视图与转场 ---------- */
.screen,.sub{position:absolute;inset:0;display:none;overflow:hidden;background:var(--pagebg)}
.screen.active,.sub.active{display:block}
.sub{z-index:50}
.sub.plain{--pagebg:var(--plain)}
@keyframes v-open{from{opacity:0;transform:scale(.3)}to{opacity:1;transform:none}}
@keyframes v-push{from{opacity:.3;transform:translateX(32%)}to{opacity:1;transform:none}}
@keyframes v-pop{from{opacity:.3;transform:translateX(-18%)}to{opacity:1;transform:none}}
@keyframes v-home{from{opacity:.4;transform:scale(1.08)}to{opacity:1;transform:none}}
body[data-nav=open] .screen.active,body[data-nav=open] .sub.active{animation:v-open .42s var(--ease)}
body[data-nav=push] .screen.active,body[data-nav=push] .sub.active{animation:v-push .36s var(--ease)}
body[data-nav=pop] .screen.active,body[data-nav=pop] .sub.active{animation:v-pop .36s var(--ease)}
body[data-nav=home] #home.active{animation:v-home .4s var(--ease)}

/* ---------- 桌面 ---------- */
#home{background:#000}
.home-wall{position:absolute;inset:0;overflow:hidden}
.home-dim{position:absolute;inset:0;pointer-events:none}
@media (prefers-color-scheme:dark){.home-dim{background:rgba(0,0,0,.28)}}
.home-date{position:relative;min-height:26px;text-align:center;padding-top:calc(var(--top) + 30px);color:rgba(255,255,255,.92);font-size:20px;font-weight:600;text-shadow:0 1px 8px rgba(0,0,0,.25)}
.home-time{position:relative;text-align:center;margin-top:2px;color:#fff;font-size:96px;font-weight:200;letter-spacing:-2px;line-height:1;font-variant-numeric:tabular-nums;text-shadow:0 2px 20px rgba(0,0,0,.25)}
.app-grid{position:relative;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));row-gap:26px;padding:44px 20px 0;justify-items:center}
.app-cell{display:flex;flex-direction:column;align-items:center;gap:6px;width:76px}
.app-icon,.app-icon-static{position:relative;width:62px;height:62px;border-radius:14px;overflow:hidden;display:flex;align-items:center;justify-content:center;color:#fff;
  box-shadow:inset 0 0 0 .5px rgba(255,255,255,.18),0 6px 16px rgba(0,0,0,.22)}
.app-icon{cursor:pointer}
.app-icon::before,.app-icon-static::before{content:"";position:absolute;left:-10%;right:-10%;top:-45%;height:80%;pointer-events:none;
  background:radial-gradient(ellipse at 50% 100%,rgba(255,255,255,.38),rgba(255,255,255,0) 65%)}
.app-icon svg,.app-icon-static svg{position:relative;width:32px;height:32px;filter:drop-shadow(0 1px 1.5px rgba(0,0,0,.18))}
.app-name{font-size:12px;font-weight:500;color:#fff;text-shadow:0 1px 3px rgba(0,0,0,.45)}
.i-wx{background:linear-gradient(180deg,#62EA87 0%,#1EBE4E 100%)}
.i-vc{background:linear-gradient(180deg,#FFB347 0%,#FF5E3A 100%)}
.i-st{background:linear-gradient(180deg,#A2A2A8 0%,#5F5F65 100%)}
.i-lr{background:linear-gradient(180deg,#FFD84D 0%,#FF9F0A 100%)}
.i-mm{background:linear-gradient(180deg,#C77DFF 0%,#6A4CF5 100%)}
.i-dt{background:linear-gradient(180deg,#5AD4FF 0%,#0A7BFF 100%)}
.dock{position:absolute;left:12px;right:12px;bottom:12px;height:94px;border-radius:38px;display:flex;justify-content:space-around;align-items:center;padding:0 16px;
  background:rgba(255,255,255,.2);-webkit-backdrop-filter:blur(30px) saturate(180%);backdrop-filter:blur(30px) saturate(180%);
  box-shadow:inset 0 .5px 0 rgba(255,255,255,.55),inset 0 -.5px 0 rgba(0,0,0,.1),0 0 0 .5px rgba(255,255,255,.12)}
@media (prefers-color-scheme:dark){.dock{background:rgba(30,30,34,.32);box-shadow:inset 0 .5px 0 rgba(255,255,255,.22),inset 0 -.5px 0 rgba(0,0,0,.3)}}

/* ---------- 页头（玻璃圆按钮）与滚动区 ---------- */
.page-head,.navbar{position:absolute;top:0;left:0;right:0;z-index:20;display:flex;align-items:center;gap:8px;
  padding:calc(var(--top) + 4px) 16px 14px;background:linear-gradient(var(--pagebg) 62%,transparent);pointer-events:none}
.page-head>*,.navbar>*{pointer-events:auto}
.navbar.clear{background:none}
.ph-btn,.back,.nav-btn{width:44px;height:44px;border-radius:50%;display:flex;align-items:center;justify-content:center;color:var(--label);flex:none}
.nav-btn.cap{width:auto;padding:0 16px;border-radius:22px;gap:4px;font-size:17px;font-weight:600;color:var(--blue)}
.navbar .title{flex:1;min-width:0;text-align:center;font-size:17px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.large-title{font-size:34px;font-weight:700;letter-spacing:.3px;line-height:41px;padding:0 20px 8px}
.page-scroll,.sub-body{position:absolute;inset:0;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;padding-top:var(--navh)}
.page-scroll{padding-bottom:calc(var(--sab) + 110px)}
.sub-body{padding-bottom:calc(var(--sab) + 32px)}

/* ---------- 分组列表 ---------- */
.group-title{font-size:13px;color:var(--label2);padding:20px 36px 7px}
.large-title+.group-title{padding-top:6px}
.group-foot{font-size:13px;line-height:18px;color:var(--label2);padding:7px 36px 0}
.group-foot.center{text-align:center}
.group-foot+.group{margin-top:28px}
.group,.menu-group{margin:0 16px;background:var(--card);border-radius:26px;overflow:hidden}
.menu-group{margin-bottom:20px}
.cell{position:relative;display:flex;align-items:center;gap:12px;width:100%;min-height:52px;padding:0 16px;text-align:left}
.cell.tap{cursor:pointer}
.cell+.cell::before{content:"";position:absolute;top:0;left:16px;right:0;border-top:.5px solid var(--sep)}
.cell.row-btn+.cell.row-btn::before{left:60px}
.cell.center{justify-content:center}
.cell .label{flex:none;font-size:17px;white-space:nowrap}
.cell .value{flex:1;min-width:0;color:var(--label2);font-size:17px;text-align:right;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.chev,.mi-chev{color:var(--label3)}
.cell-edit{flex:1;min-width:0;border:0;background:none;outline:none;font-size:17px;color:var(--label);text-align:right;-webkit-appearance:none;appearance:none}
.cell-edit::placeholder{color:var(--label3)}
.cell-edit.boxed{height:38px;padding:0 12px;border-radius:12px;background:var(--fill);text-align:left}
.cell-edit.num{flex:none;width:76px;text-align:center}
.cell.col{flex-direction:column;align-items:stretch;padding:12px 16px}
.cell.col textarea{min-height:120px;text-align:left;resize:none;line-height:24px;display:block}
.menu-group .menu-item{position:relative;display:flex;align-items:center;gap:14px;min-height:52px;padding:0 16px;cursor:pointer}
.menu-group .menu-item+.menu-item::before{content:"";position:absolute;top:0;left:60px;right:0;border-top:.5px solid var(--sep)}
.mi-ico{width:30px;height:30px;border-radius:8px;display:flex;align-items:center;justify-content:center;color:#fff;flex:none;overflow:hidden}
.mi-ico svg{width:19px;height:19px}
.mi-ico.sm{width:26px;height:26px;border-radius:7px}
.mi-ico.sm svg{width:16px;height:16px}
.mi-name{flex:1;min-width:0;font-size:17px}
.mi-val{color:var(--label2);font-size:17px;font-variant-numeric:tabular-nums}
.mi-badge{min-width:22px;height:22px;padding:0 7px;border-radius:11px;background:var(--red);color:#fff;font-size:15px;font-weight:500;display:flex;align-items:center;justify-content:center}
.profile .menu-item{min-height:84px;padding:12px 16px}
.mi-ico.me-av{width:62px;height:62px;border-radius:50%;font-size:26px;font-weight:600;background:linear-gradient(180deg,#5AB0FF,#1F6FEB)}
.profile .mi-name{display:flex;flex-direction:column;gap:2px}
.profile .mi-name b{font-size:22px;font-weight:700}
.profile .mi-name small{font-size:15px;color:var(--label2)}
.list-card{margin:0 16px}
.list-card:has(>:not(.empty)){background:var(--card);border-radius:26px;overflow:hidden}
.model-manual-ok{margin:16px 16px 0}
.card{margin:0 16px 12px;padding:16px;border-radius:24px;background:var(--card)}
.pad{padding:8px 16px 0}

/* 开关 / 滑块 */
.switch{position:relative;flex:none;width:51px;height:31px;border-radius:16px;background:var(--fill2);cursor:pointer;transition:background-color .25s}
.switch::after{content:"";position:absolute;top:2px;left:2px;width:27px;height:27px;border-radius:50%;background:#fff;box-shadow:0 3px 8px rgba(0,0,0,.15),0 1px 1px rgba(0,0,0,.16);transition:transform .25s var(--ease)}
.switch.on{background:var(--green)}
.switch.on::after{transform:translateX(20px)}
.slider-row{flex:1;min-width:0;display:flex;align-items:center;gap:12px}
.slider-row input[type=range]{flex:1;min-width:0;accent-color:var(--blue);height:28px}
.sval{min-width:34px;text-align:right;color:var(--blue);font-size:17px;font-weight:600;font-variant-numeric:tabular-nums}

/* 按钮 */
.btn{display:flex;align-items:center;justify-content:center;gap:8px;width:100%;height:52px;margin-bottom:10px;border-radius:26px;font-size:17px;font-weight:600;text-align:center}
.btn.wx{background:var(--blue);color:#fff}
.btn.gray{background:var(--fill);color:var(--label)}
.btn.tint{background:var(--tint);color:var(--blue)}
.btn.red{background:var(--fill);color:var(--red)}
.btn:disabled{opacity:.4}
.btn.danger-text,.cell.danger-text{color:var(--red)}
.v-next{display:none}

/* 空状态 */
.empty{display:flex;flex-direction:column;align-items:center;gap:6px;padding:90px 40px 0;text-align:center;color:var(--label2);font-size:15px;line-height:22px}
.empty b{display:block;color:var(--label);font-size:20px;font-weight:600;margin-bottom:2px}
.empty.small,.list-card>.empty{padding:20px 16px}
#chatList>.empty::before,#contactList>.empty::before,#wbList>.empty::before,#momentList>.empty::before{content:"";width:64px;height:64px;margin-bottom:10px;background:var(--label3);
  -webkit-mask:var(--ico) center/contain no-repeat;mask:var(--ico) center/contain no-repeat}
#chatList>.empty{--ico:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.4' stroke-linejoin='round'%3E%3Cpath d='M12 3.5c-5 0-9 3.4-9 7.6 0 2.4 1.3 4.5 3.3 5.9l-.8 3.3 3.8-2c.9.2 1.8.3 2.7.3 5 0 9-3.4 9-7.5S17 3.5 12 3.5z'/%3E%3C/svg%3E")}
#contactList>.empty{--ico:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='8' r='3.5'/%3E%3Cpath d='M2.5 19.5c.6-3.3 3.2-5.3 6.5-5.3s5.9 2 6.5 5.3'/%3E%3Ccircle cx='17' cy='9' r='2.7'/%3E%3Cpath d='M17.5 14.3c2.3.2 3.7 1.7 4.1 4.2'/%3E%3C/svg%3E")}
#wbList>.empty{--ico:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20'/%3E%3Cpath d='M12 6.5l1 2.2 2.3.3-1.7 1.6.4 2.3-2-1.1-2 1.1.4-2.3L8.7 9l2.3-.3z'/%3E%3C/svg%3E")}
#momentList>.empty{--ico:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cpath d='M12 3.5l3.2 5.6M20.5 12h-6.4M16.2 19.4l-3.2-5.6M7.8 19.4l3.2-5.6M3.5 12h6.4M7.8 4.6l3.2 5.6'/%3E%3C/svg%3E")}
#momentList>.empty{padding-top:24px}

/* ---------- 微信：搜索、会话行、Tab Bar ---------- */
.tab-page{position:absolute;inset:0;display:none}
.tab-page.active{display:block}
.search-bar{display:flex;align-items:center;gap:6px;height:40px;margin:2px 16px 10px;padding:0 12px;border-radius:20px;background:var(--fill);color:var(--label2)}
.search-bar input{flex:1;min-width:0;height:100%;border:0;background:none;outline:none;font-size:17px;color:var(--label);-webkit-appearance:none;appearance:none}
.search-bar input::placeholder{color:var(--label2)}
.av{width:50px;height:50px;border-radius:50%;flex:none;display:flex;align-items:center;justify-content:center;color:#fff;font-size:21px;font-weight:600;background:linear-gradient(180deg,#A5ABB8,#858A96)}
.c-item{position:relative;display:flex;align-items:flex-start;gap:12px;padding-left:16px;cursor:pointer}
.c-item .av{margin-top:11px}
.c-item .info{flex:1;min-width:0;display:flex;flex-direction:column;justify-content:center;gap:2px;min-height:74px;padding:11px 16px 11px 0;border-bottom:.5px solid var(--sep)}
.c-item:last-child .info{border-bottom:0}
.c-item .name{font-size:17px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.c-item:has(.time) .name{padding-right:76px}
.c-item .last{font-size:15px;line-height:20px;color:var(--label2);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;word-break:break-all}
.c-item .time{position:absolute;top:12px;right:16px;display:flex;align-items:center;gap:6px;font-size:15px;color:var(--label2)}
.c-item .time::after{content:"";width:8px;height:13px;background:var(--label3);
  -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 13'%3E%3Cpath d='M1.5 1.5L6.5 6.5l-5 5' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%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 8 13'%3E%3Cpath d='M1.5 1.5L6.5 6.5l-5 5' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat}
.list-card .c-item .info{min-height:58px}
.tabbar{position:absolute;left:21px;right:21px;bottom:max(14px,calc(var(--sab) - 10px));z-index:40;height:62px;padding:4px;border-radius:31px;display:flex}
.tab{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px;border-radius:27px;font-size:10px;font-weight:600;color:var(--label)}
.tab .ico{position:relative;width:26px;height:26px}
.tab .ico svg{position:absolute;inset:0;width:26px;height:26px}
.tab .i-on,.tab.active .i-off{opacity:0}
.tab.active .i-on{opacity:1}
.tab.active{color:var(--blue);background:var(--fill)}

/* ---------- 聊天 ---------- */
/* --ib 输入栏离底部的距离，--inh 输入栏实际高度（打字变高时由 app.js 更新）；消息区底部留白和“正在输入”都跟着它们走 */
#sub-chat{--ib:max(12px,calc(var(--sab) - 4px));--inh:42px}
#sub-chat:has(.chat-input:focus-within){--ib:8px}
.chat-nav{align-items:flex-start;padding-bottom:10px}
.chat-who{flex:1;min-width:0;display:flex;flex-direction:column;align-items:center;gap:4px;margin-top:-2px}
.chat-who .av{width:46px;height:46px;font-size:19px}
.chat-who .av:empty{visibility:hidden}
.chat-who .title{flex:none;max-width:100%;height:24px;line-height:24px;padding:0 10px;border-radius:12px;font-size:12px;font-weight:600}
.chat-body{position:absolute;inset:0;display:flex;flex-direction:column;overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;
  padding:calc(var(--top) + 100px) 16px calc(var(--ib) + var(--inh) + 50px)}
.chat-body>:first-child{margin-top:auto}
.time-row{flex:none;margin:14px 0 6px;text-align:center;font-size:12px;font-weight:600;color:var(--label2)}
.msg{flex:none;display:flex;margin-top:2px}
.msg.me{justify-content:flex-end}
.msg.sys{justify-content:center}
.msg.me+.msg.other,.msg.other+.msg.me,.msg.sys+.msg:not(.sys),.msg:not(.sys)+.msg.sys{margin-top:12px}
.msg .avatar{display:none}
.bubble{position:relative;z-index:0;max-width:75%;padding:8px 13px;border-radius:19px;font-size:17px;line-height:22px;white-space:pre-wrap;overflow-wrap:anywhere}
.msg.me .bubble{background:var(--blue);color:#fff}
.msg.other .bubble{background:var(--bubble);color:var(--label)}
/* 一组连续消息里最后一条带尾巴 */
.msg.me:not(:has(+.msg.me))>.bubble:not(.img)::before,.msg.other:not(:has(+.msg.other))>.bubble:not(.img)::before{content:"";position:absolute;bottom:0;width:20px;height:20px;z-index:-1}
.msg.me:not(:has(+.msg.me))>.bubble:not(.img)::after,.msg.other:not(:has(+.msg.other))>.bubble:not(.img)::after{content:"";position:absolute;bottom:0;width:10px;height:20px;z-index:-1;background:var(--pagebg)}
.msg.me:not(:has(+.msg.me))>.bubble:not(.img)::before{right:-7px;background:var(--blue);border-bottom-left-radius:16px 14px}
.msg.me:not(:has(+.msg.me))>.bubble:not(.img)::after{right:-10px;border-bottom-left-radius:10px}
.msg.other:not(:has(+.msg.other))>.bubble:not(.img)::before{left:-7px;background:var(--bubble);border-bottom-right-radius:16px 14px}
.msg.other:not(:has(+.msg.other))>.bubble:not(.img)::after{left:-10px;border-bottom-right-radius:10px}
.msg .bubble.img{max-width:none;padding:0;border-radius:18px;overflow:hidden;background:none}
.bubble.img img{display:block;width:auto;height:auto;min-width:64px;min-height:64px;max-width:min(220px,60vw);max-height:240px;border-radius:18px}
.msg.sys .bubble{max-width:100%;padding:4px 28px;background:none;color:var(--label2);font-size:13px;line-height:18px;text-align:center}
/* 正在输入：灰色三点气泡（#typingName 当第一个点，.dots 的前后伪元素当后两个） */
.typing-bar{position:absolute;left:18px;bottom:calc(var(--ib) + var(--inh) + 12px);z-index:25;display:none;align-items:center;justify-content:center;gap:5px;
  width:64px;height:38px;border-radius:19px;background:var(--bubble);font-size:0;color:transparent}
.typing-bar.show{display:flex}
.typing-bar::before{content:"";position:absolute;left:-2px;bottom:-2px;width:13px;height:13px;border-radius:50%;background:var(--bubble)}
.typing-bar::after{content:"";position:absolute;left:-7px;bottom:-7px;width:6px;height:6px;border-radius:50%;background:var(--bubble)}
#typingName,.typing-bar .dots::before,.typing-bar .dots::after{display:block;width:8px;height:8px;border-radius:50%;background:var(--label2);overflow:hidden;animation:typ 1.2s infinite ease-in-out}
.typing-bar .dots{display:flex;gap:5px}
.typing-bar .dots::before{content:"";animation-delay:.18s}
.typing-bar .dots::after{content:"";animation-delay:.36s}
@keyframes typ{0%,60%,100%{opacity:.35;transform:translateY(0)}30%{opacity:1;transform:translateY(-2px)}}
.chat-input{position:absolute;left:12px;right:12px;bottom:var(--ib);z-index:30;display:flex;align-items:flex-end;gap:8px}
.chat-input .plus{width:42px;height:42px;border-radius:50%;display:flex;align-items:center;justify-content:center;color:var(--label);flex:none}
.input-wrap{flex:1;min-width:0;min-height:42px;display:flex;align-items:flex-end;gap:8px;padding:5px 5px 5px 16px;border-radius:21px}
#input{flex:1;min-width:0;display:block;max-height:120px;padding:5px 0;border:0;background:none;outline:none;resize:none;font-size:17px;line-height:22px;color:var(--label)}
#input::placeholder{color:var(--label2)}
.send{width:32px;height:32px;border-radius:50%;flex:none;display:flex;align-items:center;justify-content:center;background:var(--blue);color:#fff}
#input:placeholder-shown+.send{background:transparent;color:var(--label3)}
.send:disabled{background:var(--fill2);color:var(--label3)}

/* ---------- 选择模型 / 壁纸 / 关于 ---------- */
#sub-models .list-card{margin-top:8px}
.model-item{position:relative;display:flex;align-items:center;gap:12px;min-height:52px;padding:0 16px;cursor:pointer}
.model-item+.model-item::before{content:"";position:absolute;top:0;left:16px;right:0;border-top:.5px solid var(--sep)}
.model-item .mid{flex:1;min-width:0;padding:14px 0;font-size:17px;word-break:break-all}
.model-item .check{display:flex;color:var(--blue);opacity:0}
.model-item.sel .check{opacity:1}
.wp-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:44px 12px;padding:12px 16px 40px}
.wp-item{position:relative;aspect-ratio:9/16;border-radius:18px;cursor:pointer;box-shadow:0 0 0 .5px var(--sep)}
.wp-item.sel{box-shadow:0 0 0 3px var(--pagebg),0 0 0 6px var(--blue)}
.wp-label{position:absolute;top:calc(100% + 8px);left:0;right:0;text-align:center;font-size:13px;color:var(--label)}
.wp-item.sel .wp-label{color:var(--blue);font-weight:600}
.wp-check{position:absolute;right:8px;bottom:8px;width:24px;height:24px;border-radius:50%;display:none;align-items:center;justify-content:center;background:var(--blue);color:#fff;box-shadow:0 0 0 2px #fff}
.wp-check svg{width:13px;height:13px}
.wp-item.sel .wp-check{display:flex}
.wp-item{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none}
.wp-grid+.group-title{padding-top:0}
#sub-wallpaper .group-foot{margin-top:-14px}
/* 自定义壁纸：添加格子、全屏预览（照 iOS 添加墙纸：左上取消、右上设定） */
.wp-add{display:flex;align-items:center;justify-content:center;background:var(--fill);box-shadow:none;color:var(--blue)}
.wp-add-ico{width:46px;height:46px;border-radius:50%;display:flex;align-items:center;justify-content:center;background:var(--card);box-shadow:0 2px 10px rgba(0,0,0,.08)}
.wp-add-ico svg{width:22px;height:22px}
.wp-preview{position:absolute;inset:0;z-index:60;overflow:hidden;background:#000;opacity:0;transform:scale(1.04);transition:opacity .3s var(--ease),transform .4s var(--ease)}
.wp-preview.show{opacity:1;transform:none}
.wp-pv-img{position:absolute;inset:0;background:#000 center/cover no-repeat}
.wp-preview .home-date{padding-top:calc(var(--top) + 76px)}
.wp-pv-bar{position:absolute;top:calc(var(--top) + 6px);left:16px;right:16px;display:flex;justify-content:space-between}
.nav-btn.cap.primary{background:var(--blue);color:#fff;box-shadow:0 6px 20px rgba(0,0,0,.18)}
.nav-btn.cap:disabled{opacity:.5}
.about-head{display:flex;flex-direction:column;align-items:center;padding:18px 0 22px}
.about-logo{width:92px;height:92px;border-radius:21px}
.about-logo svg{width:46px;height:46px}
.about-name{margin-top:14px;font-size:28px;font-weight:700}
.about-ver{margin-top:2px;font-size:15px;color:var(--label2)}
#sub-about .group-foot{padding-top:16px}

/* ---------- 世界书 / 记忆 ---------- */
.lore-keys{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:10px}
.chip{display:inline-flex;align-items:center;height:26px;padding:0 10px;border-radius:13px;background:rgba(255,149,0,.16);color:var(--orange-t);font-size:13px;font-weight:600}
.lore-text{font-size:15px;line-height:21px;color:var(--label2);white-space:pre-wrap;overflow-wrap:anywhere;-webkit-user-select:text;user-select:text}
.lore-del{display:flex;align-items:center;height:32px;margin:12px 0 0 auto;padding:0 14px;border-radius:16px;background:rgba(255,59,48,.12);color:var(--red-t);font-size:15px;font-weight:600}
.mem-card{margin-top:8px;padding:18px 18px 20px}
.mem-head{display:flex;align-items:center;gap:8px;margin-bottom:12px;font-size:15px;font-weight:600;color:var(--orange-t)}
#memText{font-size:17px;line-height:26px;white-space:pre-wrap;-webkit-user-select:text;user-select:text}
#sub-memory .group-foot{padding-top:4px}

/* ---------- 背单词 ---------- */
.vocab-stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;padding:4px 16px 12px}
.vs-item{display:flex;flex-direction:column-reverse;justify-content:flex-end;gap:6px;padding:12px 14px 14px;border-radius:22px;background:var(--card)}
.vs-lbl{display:flex;align-items:center;gap:5px;font-size:13px;font-weight:600;white-space:nowrap}
.vs-item:nth-child(1) .vs-lbl{color:var(--orange-t)}
.vs-item:nth-child(2) .vs-lbl{color:var(--green-t)}
.vs-item:nth-child(3) .vs-lbl{color:var(--red-t)}
.vs-num{font-size:30px;font-weight:700;letter-spacing:-.5px;line-height:1;font-variant-numeric:tabular-nums}
.vocab-card{margin:0 16px;padding:22px 16px 16px;border-radius:28px;background:var(--card)}
.v-word{text-align:center;font-size:40px;font-weight:700;letter-spacing:-.5px;overflow-wrap:anywhere}
.v-phonetic{margin-top:4px;text-align:center;font-size:15px;color:var(--label2)}
.v-options{margin-top:8px}
.v-opt{display:flex;align-items:center;justify-content:center;gap:8px;min-height:56px;margin-top:10px;padding:8px 14px;border-radius:18px;background:var(--fill);font-size:17px;font-weight:500;text-align:center;cursor:pointer}
.v-opt.correct{background:rgba(52,199,89,.18);color:var(--green-t)}
.v-opt.wrong{background:rgba(255,59,48,.16);color:var(--red-t)}
.v-opt.correct::before,.v-opt.wrong::before{content:"";width:18px;height:18px;background:currentColor;
  -webkit-mask:var(--ico) center/contain no-repeat;mask:var(--ico) center/contain no-repeat}
.v-opt.correct{--ico:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E")}
.v-opt.wrong{--ico:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E")}
.v-options:has(.correct) .v-opt:not(.correct):not(.wrong){opacity:.45}
.v-result{min-height:22px;margin:18px 16px 12px;text-align:center;font-size:17px;font-weight:600}
.v-result:empty{margin:8px 16px}
.v-result.ok{color:var(--green-t)}
.v-result.no{color:var(--red-t)}
#sub-vocab .pad .btn{margin-bottom:0}

/* ---------- 朋友圈 ---------- */
.cover-page{padding-top:0}
.moments-cover{position:relative;height:calc(var(--top) + 250px);margin-bottom:48px;
  background:radial-gradient(110% 60% at 50% 0%,#FFC27A 0%,rgba(255,194,122,0) 55%),radial-gradient(90% 70% at 0% 55%,#FF5E7E 0%,rgba(255,94,126,0) 60%),radial-gradient(100% 70% at 100% 90%,#7A3FD1 0%,rgba(122,63,209,0) 65%),linear-gradient(180deg,#F0784F 0%,#B23A6B 50%,#3A1A55 100%)}
.mc-name{position:absolute;right:96px;bottom:12px;color:#fff;font-size:20px;font-weight:700;text-shadow:0 1px 6px rgba(0,0,0,.35)}
.mc-av{position:absolute;right:16px;bottom:-32px;width:68px;height:68px;border-radius:18px;display:flex;align-items:center;justify-content:center;
  color:#fff;font-size:28px;font-weight:600;background:linear-gradient(180deg,#5AB0FF,#1F6FEB);box-shadow:0 0 0 3px var(--pagebg)}
.c-head{display:flex;align-items:center;gap:10px}
.c-av{width:40px;height:40px;border-radius:50%;flex:none;display:flex;align-items:center;justify-content:center;color:#fff;font-size:17px;font-weight:600;background:linear-gradient(180deg,#5AB0FF,#1F6FEB)}
.c-name{font-size:17px;font-weight:600}
.c-text{margin-top:10px;font-size:17px;line-height:24px;white-space:pre-wrap;overflow-wrap:anywhere;-webkit-user-select:text;user-select:text}
.c-foot{display:flex;align-items:center;justify-content:space-between;margin-top:12px}
.like-btn{display:flex;align-items:center;gap:5px;height:32px;padding:0 12px 0 10px;border-radius:16px;background:var(--fill);font-size:15px;font-weight:600;color:var(--label)}
.like-btn.liked{background:rgba(255,59,48,.12);color:var(--red-t)}
.c-time{font-size:13px;color:var(--label2)}
.add-fab{display:none}

/* ---------- 钱包 ---------- */
.wallet-balance{position:relative;display:flex;flex-direction:column;justify-content:space-between;height:222px;margin:8px 16px 0;padding:20px 22px;border-radius:22px;overflow:hidden;color:#fff;
  background:radial-gradient(80% 90% at 100% 0%,rgba(90,200,250,.55) 0%,rgba(90,200,250,0) 60%),radial-gradient(70% 80% at 0% 100%,rgba(191,90,242,.55) 0%,rgba(191,90,242,0) 60%),linear-gradient(135deg,#2A2D4A 0%,#14152A 100%);
  box-shadow:0 14px 30px rgba(20,21,42,.35),inset 0 .5px 0 rgba(255,255,255,.35)}
.wallet-balance::before{content:"";position:absolute;inset:0;background:linear-gradient(115deg,rgba(255,255,255,0) 30%,rgba(255,255,255,.16) 45%,rgba(255,255,255,0) 60%)}
.wb-top{position:relative;display:flex;justify-content:space-between;align-items:center}
.wb-lbl{font-size:15px;font-weight:600;opacity:.85}
.wb-brand{display:flex;align-items:center;gap:5px;font-size:15px;font-weight:700}
.wb-num{position:relative;font-size:46px;font-weight:700;letter-spacing:-.5px;font-variant-numeric:tabular-nums}
.wallet-actions{display:flex;gap:10px;padding:16px 16px 0}
.wa-in,.wa-out{flex:1;height:52px;border-radius:26px;font-size:17px;font-weight:600;text-align:center}
.wa-in{background:var(--blue);color:#fff}
.wa-out{background:var(--tint);color:var(--blue)}
.wallet-actions+.group-title{padding-top:14px}
.bill-item{position:relative;display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"note amt" "time amt";align-items:center;column-gap:12px;min-height:62px;padding:10px 16px}
.bill-item+.bill-item::before{content:"";position:absolute;top:0;left:16px;right:0;border-top:.5px solid var(--sep)}
.bi-note{grid-area:note;font-size:17px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.bi-time{grid-area:time;margin-top:1px;font-size:13px;color:var(--label2)}
.bi-amt{grid-area:amt;font-size:17px;font-weight:600;font-variant-numeric:tabular-nums}
.bi-amt.in{color:var(--green-t)}

/* ---------- Sheet ---------- */
.sheet-mask{position:absolute;inset:0;z-index:70;background:rgba(0,0,0,.32);opacity:0;pointer-events:none;transition:opacity .3s}
.sheet-mask.show{opacity:1;pointer-events:auto}
.sheet{position:absolute;left:8px;right:8px;bottom:8px;z-index:71;max-height:calc(100% - var(--top) - 24px);overflow-y:auto;overscroll-behavior:contain;
  padding:8px 16px 18px;border-radius:40px;background:var(--sheet);-webkit-backdrop-filter:blur(30px) saturate(180%);backdrop-filter:blur(30px) saturate(180%);
  box-shadow:inset 0 .5px 0 var(--glass-hi),0 0 0 .5px var(--glass-rim),0 -10px 40px rgba(0,0,0,.2);
  transform:translateY(calc(100% + 40px));visibility:hidden;transition:transform .42s var(--ease),visibility 0s .42s}
.sheet.show{transform:none;visibility:visible;transition:transform .42s var(--ease),visibility 0s}
.sheet-handle{width:36px;height:5px;margin:0 auto 16px;border-radius:3px;background:var(--label3)}
.sheet-title{margin-bottom:16px;text-align:center;font-size:17px;font-weight:600}
.sheet-hint{margin:-4px 0 14px;text-align:center;font-size:13px;color:var(--label2)}
.field{margin-bottom:14px}
.field label{display:block;padding:0 6px 6px;font-size:13px;color:var(--label2)}
.field input,.field textarea{display:block;width:100%;min-height:48px;padding:13px 14px;border:0;border-radius:14px;background:var(--fill);outline:none;font-size:17px;line-height:22px;color:var(--label);-webkit-appearance:none;appearance:none}
.field textarea{min-height:92px;resize:none}
.field input::placeholder,.field textarea::placeholder{color:var(--label2)}
.or{display:flex;align-items:center;gap:10px;margin:4px 0 14px;font-size:13px;color:var(--label2)}
.or::before,.or::after{content:"";flex:1;height:.5px;background:var(--sep)}
/* 操作菜单（一组 .menu-item + 取消） */
#sheetContent>.menu-item{position:relative;display:flex;align-items:center;justify-content:center;height:56px;padding:0 16px;background:var(--asbg);font-size:19px;color:var(--label);cursor:pointer}
#sheetContent>.menu-item:first-child{border-radius:22px 22px 0 0}
#sheetContent>.menu-item:last-of-type{border-radius:0 0 22px 22px}
#sheetContent>.menu-item:first-child:last-of-type{border-radius:22px}
#sheetContent>.menu-item+.menu-item::before{content:"";position:absolute;top:0;left:0;right:0;border-top:.5px solid var(--sep)}
#sheetContent>.menu-item.danger{color:var(--red)}
#sheetContent:has(>.menu-item)>.btn.gray{height:56px;margin:8px 0 0;border-radius:22px;background:var(--asbg);font-size:19px;font-weight:600}

/* ---------- Toast ---------- */
#toast{position:absolute;top:calc(var(--top) + 4px);left:50%;z-index:99;max-width:calc(100% - 120px);height:44px;line-height:44px;padding:0 18px;border-radius:22px;
  font-size:15px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;pointer-events:none;
  opacity:0;transform:translate(-50%,-130%);transition:transform .42s var(--ease),opacity .3s}
#toast.show{opacity:1;transform:translate(-50%,0)}

/* ---------- 设置：分类卡片、账号卡、用户管理 ---------- */
#sub-settings .group+.group,#sub-set-account .group+.group{margin-top:28px}
.cell.acct{min-height:84px;padding:12px 16px;gap:14px}
.cell.acct .mi-name{display:flex;flex-direction:column;gap:2px;min-width:0}
.cell.acct .mi-name b{font-size:22px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cell.acct .mi-name small{font-size:15px;color:var(--label2)}
.cell.acct .chev{margin-left:auto}
.mi-ico.user-av{border-radius:50%;font-size:15px;font-weight:600;background:linear-gradient(180deg,#A5ABB8,#858A96)}
.user-row.off .label,.user-row.off .user-av{opacity:.45}
.switch.disabled{opacity:.4}

/* ---------- 会话左滑操作 ---------- */
.c-swipe{position:relative;overflow:hidden;touch-action:pan-y;-webkit-touch-callout:none}
.c-swipe>.c-item{z-index:1;background-color:var(--pagebg);transition:transform .35s var(--ease),background-color .2s}
.c-swipe.pinned>.c-item{background-color:var(--pin-bg)}
.c-swipe.dragging>.c-item{transition:background-color .2s}
.c-swipe:last-child>.c-item .info{border-bottom:0}
.c-acts{position:absolute;top:0;right:0;bottom:0;display:flex;transition:visibility 0s}
.c-swipe:not(.dragging):not(.open) .c-acts{visibility:hidden;transition:visibility 0s .35s}
.c-act{width:78px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;color:#fff;font-size:14px;font-weight:600;text-align:center}
.c-act.pin{background:var(--orange)}
.c-act.del{background:var(--red)}
.c-act:active{filter:brightness(.88)}

/* ---------- 长按菜单（上下文菜单） ---------- */
.ctx-layer{position:absolute;inset:0;z-index:80}
.ctx-mask{position:absolute;inset:0;background:rgba(0,0,0,.14);-webkit-backdrop-filter:blur(14px);backdrop-filter:blur(14px);opacity:0;transition:opacity .3s}
.ctx-layer.show .ctx-mask{opacity:1}
.ctx-preview{position:absolute;overflow:hidden;border-radius:22px;background:var(--card);box-shadow:0 0 0 .5px var(--glass-rim),0 12px 40px rgba(0,0,0,.18);pointer-events:none;
  transition:transform .42s var(--ease),top .42s var(--ease)}
.ctx-layer.show .ctx-preview{transform:scale(.96)}
.ctx-preview>.c-item{background:none}
.ctx-preview .info{border-bottom:0}
.ctx-menu{position:absolute;left:16px;width:250px;padding:6px;border-radius:26px;background:var(--sheet);-webkit-backdrop-filter:blur(30px) saturate(180%);backdrop-filter:blur(30px) saturate(180%);
  box-shadow:inset 0 .5px 0 var(--glass-hi),0 0 0 .5px var(--glass-rim),0 12px 40px rgba(0,0,0,.2);
  opacity:0;transform:scale(.5);transition:transform .42s var(--ease),opacity .25s}
.ctx-layer.show .ctx-menu{opacity:1;transform:none}
.ctx-item{display:flex;align-items:center;gap:12px;width:100%;height:46px;padding:0 14px;border-radius:20px;font-size:17px;color:var(--label);transition:background-color .2s}
.ctx-item:active{background-color:var(--fill)}
.ctx-item.danger{color:var(--red)}

/* ---------- 提示框（iOS 26：左对齐文字、胶囊按钮） ---------- */
.alert-layer{position:absolute;inset:0;z-index:95;display:flex;align-items:center;justify-content:center;padding:24px;background:rgba(0,0,0,.2);opacity:0;transition:opacity .25s}
.alert-layer.show{opacity:1}
.alert{width:min(100%,300px);padding:22px 16px 16px;border-radius:34px;background:var(--sheet);-webkit-backdrop-filter:blur(30px) saturate(180%);backdrop-filter:blur(30px) saturate(180%);
  box-shadow:inset 0 .5px 0 var(--glass-hi),0 0 0 .5px var(--glass-rim),0 16px 50px rgba(0,0,0,.22);transform:scale(1.08);transition:transform .35s var(--ease)}
.alert-layer.show .alert{transform:none}
.alert-title{padding:0 8px;font-size:17px;font-weight:600;line-height:22px;overflow-wrap:anywhere}
.alert-msg{margin-top:6px;padding:0 8px;font-size:15px;line-height:20px;color:var(--label2);white-space:pre-line;overflow-wrap:anywhere}
.alert-title:empty,.alert-msg:empty{display:none}
.alert-btns{display:flex;gap:10px;margin-top:20px}
.alert-btns.stack{flex-direction:column}
.alert-btns .btn{flex:1;min-width:0;height:48px;margin:0;padding:0 12px;border-radius:24px}

/* ---------- 无障碍与降级 ---------- */
@supports not ((-webkit-backdrop-filter:blur(1px)) or (backdrop-filter:blur(1px))){
  .glass,#toast,.sheet,.ctx-menu,.alert{background:var(--card)}
  .dock{background:rgba(40,40,44,.75)}
}
@media (prefers-reduced-transparency:reduce){
  .glass,#toast,.sheet,.ctx-menu,.alert{background:var(--card);-webkit-backdrop-filter:none;backdrop-filter:none}
  .ctx-mask{background:rgba(0,0,0,.4);-webkit-backdrop-filter:none;backdrop-filter:none}
  .dock{background:rgba(40,40,44,.92);-webkit-backdrop-filter:none;backdrop-filter:none}
}
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}
}

/* ---------- 接后端后新增：换回复、流式、登录、记忆、世界书条目 ---------- */
.swipe-nav{flex:none;display:flex;align-items:center;gap:2px;margin:4px 0 0 2px;align-self:flex-start;color:var(--label2);font-size:13px;font-weight:600;font-variant-numeric:tabular-nums}
.swipe-nav button{width:30px;height:28px;border-radius:14px;display:flex;align-items:center;justify-content:center;color:var(--label2)}
.swipe-nav button:disabled{opacity:.3}
.swipe-nav button:active{background:var(--fill)}
.msg.swipe-out .bubble{transition:transform .18s var(--ease),opacity .18s}
.msg.swipe-l .bubble{transform:translateX(-24px);opacity:.4}
.msg.swipe-r .bubble{transform:translateX(24px);opacity:.4}
.caret{display:inline-block;width:2px;height:1.05em;margin-left:2px;vertical-align:-2px;background:currentColor;animation:typ 1s infinite}
.send.stop{background:var(--label);color:var(--pagebg)}
.load-more{flex:none;align-self:center;margin:6px 0 10px;padding:6px 14px;border-radius:14px;background:var(--fill);font-size:13px;font-weight:600;color:var(--label2)}
.login-body{display:flex;flex-direction:column;justify-content:center;padding-top:var(--top)}
.login-body .about-head{padding-bottom:20px}
.login-body .pad{padding-top:20px}
.mem-who{padding-top:0;padding-bottom:4px}
.cell.col textarea.short{min-height:72px}
.sum-card{cursor:pointer}
.sum-head{display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin-bottom:8px;font-size:13px;font-weight:600;color:var(--label2)}
.sum-text{font-size:16px;line-height:24px;white-space:pre-wrap;overflow-wrap:anywhere}
.sum-card.merged{opacity:.55}
.sum-card.merged .sum-text{font-size:14px;line-height:20px}
.chip.gray{background:var(--fill);color:var(--label2)}
.chip.blue{background:var(--tint);color:var(--blue)}
.chip.red{background:rgba(255,59,48,.12);color:var(--red-t)}
.entry-card{cursor:pointer}
.entry-card.off{opacity:.5}
.entry-card .lore-text{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}
.cell .sub-label{display:block;font-size:13px;color:var(--label2);margin-top:2px}
.cell .grow{flex:1;min-width:0;padding:12px 0}
.cell .grow .t{font-size:17px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.seg{display:flex;gap:4px;padding:3px;border-radius:12px;background:var(--fill)}
.seg button{flex:1;display:flex;align-items:center;justify-content:center;height:32px;border-radius:9px;font-size:14px;font-weight:600;color:var(--label);text-align:center}
.seg button.on{background:var(--card);box-shadow:0 1px 4px rgba(0,0,0,.12)}
.field .seg{margin:0}
.field-row{display:flex;gap:10px}
.field-row>.field{flex:1;min-width:0}
.sheet .switch-row{display:flex;align-items:center;justify-content:space-between;min-height:48px;margin-bottom:14px;padding:0 14px;border-radius:14px;background:var(--fill);font-size:17px}
.ctx-text{font-size:13px;line-height:19px;white-space:pre-wrap;overflow-wrap:anywhere;color:var(--label2);-webkit-user-select:text;user-select:text}
.ctx-role{font-size:12px;font-weight:700;color:var(--blue);margin-bottom:4px;text-transform:uppercase}
#input+.send.stop,#input:placeholder-shown+.send.stop{background:var(--label);color:var(--pagebg)}

/* ---------- 生图 ---------- */
.msg .bubble.img img{cursor:zoom-in}
.bubble.drawing{display:flex;align-items:center;gap:8px;color:var(--label2)}
.bubble.drawing .spin{display:inline-block;width:14px;height:14px;border-radius:50%;border:2px solid var(--label3);border-top-color:var(--blue);animation:spin 1s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
.img-fail{flex:none;align-self:center;max-width:86%;margin:6px 0;padding:4px 12px;border-radius:12px;background:var(--fill);font-size:13px;line-height:18px;color:var(--label2);text-align:center}
.img-viewer{position:absolute;inset:0;z-index:90;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,.92);cursor:zoom-out}
.img-viewer img{max-width:100%;max-height:100%;object-fit:contain}
.ref-thumb{width:44px;height:44px;border-radius:10px;object-fit:cover;flex:none;background:var(--fill)}
#ciRef{min-height:64px}
.cell.col .seg{margin-top:8px}

/* ---------- 邀请码（管理员） ---------- */
.sheet .group{margin:12px 0 0}
.sheet .group-title{padding-left:20px}
.iv-code{font-family:ui-monospace,"SF Mono",Menlo,Consolas,monospace;letter-spacing:.5px}

/* ---- 剧场 ---- */
/* ============================================================
   theater.css — 「剧场」App 样式（可直接作为实现参考）
   规则：所有新增 class / 变量统一 th- 前缀；
   只作用于 .th-app 容器内，以及挂了 .th-system-overlay 的共享弹层。
   不改全局 body / .navbar / .switch / .sheet / .alert。
   ============================================================ */

/* ---------- 1. 变量 ---------- */
.th-app,.th-system-overlay{
  --th-font-ui:-apple-system,BlinkMacSystemFont,"SF Pro Text","SF Pro Display","PingFang SC","HarmonyOS Sans SC","Microsoft YaHei",sans-serif;
  --th-font-narration:"Songti SC","Songti TC","STSong","Noto Serif CJK SC","Noto Serif SC","Source Han Serif SC","SimSun",serif;
  --th-page-gutter:16px;
  --th-space-1:4px;--th-space-2:8px;--th-space-3:12px;--th-space-4:16px;--th-space-5:24px;--th-space-6:32px;
  --th-radius-card:20px;
  --th-composer-height:112px;   /* JS 测量回写 */
  --th-options-height:0px;      /* JS 测量回写 */
  --th-keyboard-offset:0px;     /* JS: VisualViewport 计算 */
  /* 跟随系统浅深色的剧场 UI 色（系统外壳用） */
  --th-gold-ink:#8A5A0B;        /* 浅色下的暖金文字（on #fff ≥ 6:1） */
  --th-gold-fill:rgba(231,201,151,.28);
  --th-dir-border:#B07A1E;
  --th-dir-bg:rgba(231,201,151,.22);
  --th-dir-ink:#6E4708;
  --th-opt-bg:rgba(255,255,255,.86);
  --th-skel:rgba(120,120,128,.16);
}
.D .th-app,.D.th-app,.D .th-system-overlay,.D.th-system-overlay,.th-app.D{
  --th-gold-ink:#E7C997;--th-gold-fill:rgba(231,201,151,.16);
  --th-dir-border:#E7C997;--th-dir-bg:rgba(231,201,151,.14);--th-dir-ink:#F0D9B0;
  --th-opt-bg:rgba(255,255,255,.08);--th-skel:rgba(255,255,255,.1);
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]) .th-app,:root:not([data-theme="light"]) .th-system-overlay{
    --th-gold-ink:#E7C997;--th-gold-fill:rgba(231,201,151,.16);
    --th-dir-border:#E7C997;--th-dir-bg:rgba(231,201,151,.14);--th-dir-ink:#F0D9B0;
    --th-opt-bg:rgba(255,255,255,.08);--th-skel:rgba(255,255,255,.1);
  }
}
/* 舞台色：只在舞台容器内定义，系统浅/深都保持深色阅读 */
.th-stage{
  --th-stage-bg:#111318;
  --th-stage-surface:#1C2028;
  --th-stage-text:#F2EEE6;      /* on bg 16.2:1 */
  --th-stage-muted:#B5B9C4;     /* on bg 9.6:1 */
  --th-stage-faint:#8E94A2;     /* on bg 5.9:1，最弱可读字 */
  --th-stage-rule:#3A414D;      /* 装饰线 */
  --th-stage-edge:#5C6576;      /* 需要可辨识的控件边 ≥3:1 */
  --th-accent:#E7C997;          /* on bg 11.6:1 */
  --th-user-accent:#A9CBFF;     /* on bg 11:1 */
  --th-error:#FF9C94;
  --th-ok:#8FDDA5;
}

/* ---------- 2. 外壳 ---------- */
.th-app{font-family:var(--th-font-ui)}
.th-large-title{font-size:34px;font-weight:700;line-height:41px;letter-spacing:.3px;padding:0 20px 8px}
.th-section{padding:0 var(--th-page-gutter)}
.th-subtle{font-size:13px;line-height:18px;color:var(--label2)}

/* ---------- 3. 桌面图标 ---------- */
.th-app-icon{background:radial-gradient(90% 70% at 50% 0%,#5B3FA8 0%,rgba(91,63,168,0) 70%),linear-gradient(170deg,#3B2A7A 0%,#26184F 55%,#5A1730 100%)}
.th-app-icon>svg{width:34px;height:34px}
.th-app-icon.th-pressed,.th-app-icon:active{transform:scale(.92);filter:brightness(.85)}

/* ---------- 4. 头像 ---------- */
.th-av{display:inline-flex;align-items:center;justify-content:center;border-radius:50%;color:#fff;font-weight:600;flex:none;font-family:var(--th-font-ui);line-height:1}
.th-tone-1{background:linear-gradient(160deg,#E68AA0,#A8455E)}  /* 林晚 */
.th-tone-2{background:linear-gradient(160deg,#7F9CC8,#3E5884)}  /* 陆知行 */
.th-tone-3{background:linear-gradient(160deg,#D9A35C,#8E5A1D)}  /* 周叔 */
.th-tone-4{background:linear-gradient(160deg,#5DBAB0,#25706A)}  /* 沈砚 */
.th-tone-5{background:linear-gradient(160deg,#9CCB6E,#4D7F2A)}  /* 阿梨 */
.th-tone-6{background:linear-gradient(160deg,#A98BE0,#5E43A0)}  /* 白夜 */
.th-tone-7{background:linear-gradient(160deg,#C9A27A,#7A5634)}  /* 程叔 */
.th-tone-me{background:linear-gradient(160deg,#6FA8FF,#2D63C8)}
.th-avatar-stack{display:inline-flex;align-items:center;flex:none}
.th-avatar-stack .th-av{width:26px;height:26px;font-size:12px;box-shadow:0 0 0 2px var(--th-stack-ring,var(--card))}
.th-avatar-stack .th-av+.th-av,.th-avatar-stack .th-more{margin-left:-8px}
.th-avatar-stack .th-more{height:26px;min-width:26px;padding:0 6px;border-radius:13px;display:inline-flex;align-items:center;justify-content:center;font-size:12px;font-weight:600;background:var(--fill2);color:var(--label);box-shadow:0 0 0 2px var(--th-stack-ring,var(--card))}
.th-avatar-stack .th-none{font-size:13px;color:var(--label2)}

/* ---------- 5. 首页 · 房间卡 ---------- */
.th-room-card{display:block;width:calc(100% - 32px);margin:0 16px 14px;border-radius:24px;overflow:hidden;background:var(--card);text-align:left;color:var(--label)}
.th-room-cover{position:relative;height:120px;overflow:hidden;background:#151821}
.th-room-cover svg{position:absolute;inset:0;width:100%;height:100%}
.th-room-cover.th-no-cover{display:flex;align-items:center;justify-content:center;background:radial-gradient(80% 90% at 50% 0%,rgba(231,201,151,.22),rgba(231,201,151,0) 70%),linear-gradient(160deg,#252A36,#14161C)}
.th-room-cover.th-no-cover span{font-family:var(--th-font-narration);font-size:44px;color:rgba(242,238,230,.9)}
.th-room-round{position:absolute;left:12px;top:12px;height:24px;padding:0 9px;border-radius:12px;font-size:12px;font-weight:600;line-height:24px;color:#F2EEE6;background:rgba(17,19,24,.72)}
.th-room-body{padding:14px 16px 14px}
.th-room-title{font-family:var(--th-font-narration);font-size:20px;font-weight:700;line-height:28px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere}
.th-room-last{font-size:15px;line-height:21px;color:var(--label2);margin-top:4px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.th-room-meta{display:flex;align-items:center;gap:8px;margin-top:12px;min-height:28px}
.th-room-meta .th-time{margin-left:auto;font-size:13px;color:var(--label2)}
.th-skel{background:var(--th-skel);border-radius:8px;position:relative;overflow:hidden}
.th-skel::after{content:"";position:absolute;inset:0;transform:translateX(-100%);background:linear-gradient(90deg,transparent,rgba(255,255,255,.35),transparent);animation:th-shimmer 1.4s infinite}
@keyframes th-shimmer{to{transform:translateX(100%)}}

/* ---------- 6. 向导 / 预览 ---------- */
.th-steps{display:flex;gap:4px;padding:0 20px 4px}
.th-steps i{flex:1;height:4px;border-radius:2px;background:var(--fill2)}
.th-steps i.th-done{background:var(--blue)}
.th-step-label{font-size:13px;color:var(--label2);padding:6px 20px 0}
.th-wizard-q{font-size:22px;font-weight:700;line-height:30px;padding:14px 20px 4px}
.th-wizard-help{font-size:15px;line-height:21px;color:var(--label2);padding:0 20px 14px}
.th-topic{min-height:150px;font-size:17px;line-height:26px;text-align:left!important}
.th-placeholder{color:var(--label2)}
.th-field-error{display:flex;align-items:center;gap:6px;font-size:13px;line-height:18px;color:var(--red-t);padding:8px 32px 0}
.th-wizard-actions{position:absolute;left:0;right:0;bottom:var(--th-keyboard-offset);z-index:30;padding:12px 16px calc(max(var(--sab),12px));background:linear-gradient(transparent,var(--pagebg) 30%)}
.th-kb .th-wizard-actions{padding-bottom:8px}
.th-check{width:24px;height:24px;border-radius:50%;flex:none;border:1.5px solid var(--label3);display:flex;align-items:center;justify-content:center}
.th-check.th-on{background:var(--blue);border-color:var(--blue);color:#fff}
.th-pick-sub{display:flex;align-items:center;gap:10px;padding:0 16px 12px 104px;font-size:15px;color:var(--label)}
.th-pick-sub .th-subtle{flex:1}
.th-count-bar{display:flex;justify-content:space-between;align-items:center;padding:0 32px 8px;font-size:13px;color:var(--label2)}
.th-count-bar strong{color:var(--blue);font-weight:600}
.th-stepper{display:flex;align-items:center;border-radius:20px;background:var(--fill);height:40px}
.th-stepper button{width:44px;height:40px;display:flex;align-items:center;justify-content:center;color:var(--blue)}
.th-stepper button[disabled]{color:var(--label3)}
.th-stepper output{min-width:40px;text-align:center;font-size:17px;font-weight:600;font-variant-numeric:tabular-nums}
.th-tag{display:inline-flex;align-items:center;gap:4px;height:22px;padding:0 8px;border-radius:11px;font-size:12px;font-weight:600;line-height:22px;white-space:nowrap;flex:none}
.th-tag.th-blue{background:var(--tint);color:var(--blue)}
.th-tag.th-gold{background:var(--th-gold-fill);color:var(--th-gold-ink)}
.th-tag.th-gray{background:var(--fill);color:var(--label2)}
.th-tag.th-red{background:rgba(255,59,48,.14);color:var(--red-t)}
.th-banner{display:flex;gap:10px;align-items:flex-start;margin:0 16px 12px;padding:12px 14px;border-radius:18px;background:var(--card);font-size:15px;line-height:21px}
.th-banner.th-error{background:rgba(255,59,48,.1)}
.th-banner.th-error .th-banner-t{color:var(--red-t)}
.th-banner-t{font-weight:600}
.th-banner .th-subtle{margin-top:2px}
.th-progress{height:4px;border-radius:2px;background:var(--fill2);overflow:hidden;position:relative}
.th-progress::after{content:"";position:absolute;top:0;bottom:0;width:40%;border-radius:2px;background:var(--blue);animation:th-indet 1.6s var(--ease) infinite}
@keyframes th-indet{from{transform:translateX(-100%)}to{transform:translateX(250%)}}
.th-spinner{width:18px;height:18px;border-radius:50%;border:2px solid var(--fill2);border-top-color:currentColor;animation:th-spin .9s linear infinite;flex:none}
@keyframes th-spin{to{transform:rotate(360deg)}}
.th-cast-card{display:flex;gap:12px;padding:14px 16px;position:relative}
.th-cast-card+.th-cast-card::before{content:"";position:absolute;top:0;left:68px;right:0;height:.5px;background:var(--sep)}
.th-cast-card .th-av{width:40px;height:40px;font-size:17px}
.th-cast-main{flex:1;min-width:0}
.th-cast-name{display:flex;align-items:center;gap:6px;flex-wrap:wrap;font-size:17px;font-weight:600;line-height:22px}
.th-cast-desc{font-size:15px;line-height:21px;color:var(--label2);margin-top:3px}
.th-cast-card .th-edit{height:44px;padding:0 4px;color:var(--blue);font-size:15px;font-weight:600;flex:none;align-self:center}
.th-preview-quote{font-family:var(--th-font-narration);font-size:17px;line-height:30px;color:var(--label)}
.th-actions-row{display:flex;gap:10px}
.th-actions-row .btn{flex:1}

/* ---------- 7. 舞台 ---------- */
.th-stage{position:absolute;inset:0;overflow:hidden;color:var(--th-stage-text);background:radial-gradient(110% 38% at 50% -6%,rgba(231,201,151,.11),rgba(231,201,151,0) 70%),var(--th-stage-bg)}
.th-stage-nav{background:linear-gradient(var(--th-stage-bg) 58%,rgba(17,19,24,0))}
.th-stage-nav .title{color:var(--th-stage-text);display:flex;flex-direction:column;align-items:center;line-height:20px}
.th-stage-nav .title small{font-size:12px;font-weight:500;color:var(--th-stage-muted);line-height:16px}
.th-cast-btn{height:44px;padding:0 10px 0 8px;border-radius:22px;display:flex;align-items:center;flex:none;--th-stack-ring:transparent}
.th-cast-btn .th-av{box-shadow:0 0 0 1.5px var(--glass)}
.th-cast-btn .th-more{box-shadow:none;background:transparent;color:var(--label);margin-left:2px}
.th-timeline{position:absolute;inset:0;overflow:hidden;display:flex;flex-direction:column;justify-content:flex-end;padding:calc(var(--sat) + 66px) var(--th-page-gutter) calc(var(--th-composer-height) + var(--th-options-height) + var(--th-keyboard-offset) + 20px)}
.th-timeline.th-top{justify-content:flex-start}
.th-round-divider{display:flex;align-items:center;justify-content:center;gap:10px;margin:28px 0 6px;font-size:12px;font-weight:600;letter-spacing:1px;color:var(--th-stage-faint)}
.th-round-divider::before,.th-round-divider::after{content:"";width:36px;height:1px;background:var(--th-stage-rule)}

.th-narration{margin:18px 0 6px;text-align:center}
.th-narration-text{font-family:var(--th-font-narration);font-size:18px;font-weight:400;line-height:32px;color:var(--th-stage-text);max-width:326px;margin:0 auto;text-wrap:pretty;line-break:strict;overflow-wrap:anywhere}
.th-narration-text p{margin:0}
.th-narration-text p+p{margin-top:14px}
.th-narration.th-long .th-narration-text{line-height:33px}
.th-cam{display:flex;align-items:center;justify-content:center;gap:4px;margin:4px auto 0;min-width:44px;height:44px;padding:0 10px;border-radius:22px;color:var(--th-stage-faint);font-size:13px}
.th-cam[aria-disabled="true"]{color:#6E7482}
.th-cam-note{font-size:12px;line-height:17px;color:var(--th-stage-faint);margin-top:-4px}

.th-line{display:grid;grid-template-columns:30px minmax(0,1fr);column-gap:10px;margin-top:20px}
.th-line-avatar{width:30px;height:30px;font-size:13px;grid-row:1/span 2;margin-top:-1px}
.th-line-name{display:flex;align-items:baseline;gap:6px;font-size:14px;font-weight:600;line-height:20px;color:var(--th-stage-text);min-width:0}
.th-line-name small{font-size:12px;font-weight:400;color:var(--th-stage-faint);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.th-line-text{font-size:17px;line-height:28px;color:var(--th-stage-text);margin-top:2px;overflow-wrap:anywhere;white-space:pre-wrap}
.th-line.th-cont{margin-top:6px}
.th-line.th-cont .th-line-text{grid-column:2;margin-top:0}
.th-line.th-streaming .th-line-text::after{content:"";display:inline-block;width:2px;height:20px;margin-left:2px;vertical-align:-4px;background:var(--th-accent);animation:th-caret 1s steps(1) infinite}
@keyframes th-caret{50%{opacity:0}}
.th-line-wait{display:flex;align-items:center;gap:6px;font-size:14px;line-height:28px;color:var(--th-stage-muted)}
.th-dots{display:inline-flex;gap:4px}
.th-dots i{width:5px;height:5px;border-radius:50%;background:var(--th-stage-muted);animation:th-dot 1.2s infinite}
.th-dots i:nth-child(2){animation-delay:.2s}.th-dots i:nth-child(3){animation-delay:.4s}
@keyframes th-dot{0%,60%,100%{opacity:.3}30%{opacity:1}}
.th-line.th-interrupted .th-line-text{color:var(--th-stage-muted)}
.th-user-line{margin-left:-12px;margin-right:-4px;padding:10px 12px 12px 10px;border-left:2px solid var(--th-user-accent);border-radius:0 14px 14px 0;background:rgba(169,203,255,.07)}
.th-user-line .th-line-name{color:var(--th-user-accent)}
.th-user-line .th-line-avatar{box-shadow:0 0 0 1.5px var(--th-user-accent)}

.th-direction{display:flex;flex-direction:column;gap:2px;margin:16px 0 4px auto;max-width:82%;width:fit-content;padding:8px 12px 9px;border:1px dashed var(--th-stage-edge);border-radius:14px;font-size:14px;line-height:20px;color:var(--th-stage-muted)}
.th-direction-tag{display:flex;align-items:center;gap:5px;font-size:12px;font-weight:700;letter-spacing:.5px;color:var(--th-accent)}

.th-presence-event{display:flex;align-items:center;gap:12px;margin:24px 0 8px;font-size:13px;line-height:18px;color:var(--th-stage-muted);white-space:nowrap}
.th-presence-event::before,.th-presence-event::after{content:"";flex:1;height:1px;background:var(--th-stage-rule)}
.th-presence-event strong{color:var(--th-stage-text);font-weight:600}

.th-scene-card{margin:18px -4px 6px;border-radius:var(--th-radius-card);overflow:hidden;background:var(--th-stage-surface);border:1px solid var(--th-stage-rule)}
.th-scene-media{position:relative;aspect-ratio:16/9;overflow:hidden;background:#0C0E13}
.th-scene-media>svg{position:absolute;inset:0;width:100%;height:100%}
.th-scene-caption{display:flex;align-items:flex-start;gap:10px;padding:10px 8px 10px 14px}
.th-scene-caption-text{flex:1;min-width:0;font-size:14px;line-height:20px;color:var(--th-stage-text)}
.th-scene-caption-text small{display:block;font-size:12px;line-height:18px;color:var(--th-stage-faint);margin-top:2px}
.th-scene-btn{min-width:44px;height:44px;padding:0 10px;border-radius:22px;display:flex;align-items:center;justify-content:center;gap:4px;color:var(--th-accent);font-size:14px;font-weight:600;flex:none}
.th-scene-card.th-generating .th-scene-media{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;background:linear-gradient(120deg,#171A21,#1F232C 50%,#171A21);background-size:200% 100%;animation:th-pan 2.4s linear infinite;color:var(--th-stage-muted);font-size:14px}
@keyframes th-pan{to{background-position:-200% 0}}
.th-scene-card.th-generating .th-progress{width:120px;background:rgba(255,255,255,.1)}
.th-scene-card.th-generating .th-progress::after{background:var(--th-accent)}
.th-scene-card.th-error .th-scene-media{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;color:var(--th-stage-muted);font-size:14px;text-align:center;padding:0 24px}
.th-scene-card.th-error .th-scene-media strong{color:var(--th-error);font-weight:600}

.th-step-status{display:flex;align-items:center;gap:10px;margin:14px 0 4px;padding:10px 6px 10px 12px;border-radius:14px;background:rgba(255,255,255,.04);font-size:14px;line-height:20px;color:var(--th-stage-muted)}
.th-step-status .th-spinner{width:16px;height:16px;border-color:rgba(255,255,255,.15);border-top-color:var(--th-accent)}
.th-step-status.th-error{background:rgba(255,120,110,.08);color:var(--th-stage-text);border:1px solid rgba(255,156,148,.35)}
.th-step-status.th-error svg{color:var(--th-error)}
.th-step-status .th-grow{flex:1;min-width:0}
.th-step-status small{display:block;font-size:12px;color:var(--th-stage-faint)}
.th-retry{min-height:36px;padding:0 12px;border-radius:18px;font-size:14px;font-weight:600;color:var(--th-accent);background:rgba(231,201,151,.12);flex:none;position:relative}
.th-retry::before{content:"";position:absolute;inset:-4px 0}

.th-jump-latest{position:absolute;left:50%;transform:translateX(-50%);bottom:calc(var(--th-composer-height) + var(--th-options-height) + var(--th-keyboard-offset) + 16px);z-index:28;height:40px;padding:0 16px 0 12px;border-radius:20px;display:flex;align-items:center;gap:6px;font-size:14px;font-weight:600;color:var(--label);white-space:nowrap}
.th-conn{position:absolute;top:calc(var(--sat) + 60px);left:50%;transform:translateX(-50%);z-index:45;height:36px;padding:0 14px;border-radius:18px;display:flex;align-items:center;gap:8px;font-size:14px;font-weight:600;white-space:nowrap;color:var(--label)}

/* ---------- 8. 选项层 ---------- */
.th-options{position:absolute;left:10px;right:10px;z-index:26;bottom:calc(var(--th-composer-height) + var(--th-keyboard-offset) + 6px);border-radius:28px;padding:10px 10px 10px;display:flex;flex-direction:column;gap:6px}
.th-options-head{display:flex;align-items:center;gap:6px;padding:0 6px 2px 8px;font-size:13px;font-weight:600;color:var(--label2);min-height:28px}
.th-options-head .th-grow{flex:1}
.th-options-head button{width:44px;height:28px;display:flex;align-items:center;justify-content:flex-end;color:var(--label2)}
.th-option-card{display:flex;align-items:flex-start;gap:10px;width:100%;min-height:48px;padding:12px 14px;border-radius:18px;background:var(--th-opt-bg);color:var(--label);text-align:left;font-size:16px;line-height:22px;transition:transform .15s var(--ease),background .15s}
.th-option-card .th-num{flex:none;width:22px;height:22px;border-radius:50%;font-size:12px;font-weight:700;line-height:22px;text-align:center;background:var(--th-gold-fill);color:var(--th-gold-ink)}
.th-option-card.th-pressed,.th-option-card:active{transform:scale(.97);background:var(--fill2)}
.th-option-card.th-chosen{background:var(--th-gold-fill)}
.th-option-card[disabled]{opacity:.45}
.th-continue{display:flex;align-items:center;justify-content:center;gap:6px;width:100%;height:44px;border-radius:22px;background:var(--tint);color:var(--blue);font-size:16px;font-weight:600}
.th-continue[disabled]{background:var(--fill);color:var(--label3)}
.th-options-note{font-size:13px;line-height:18px;color:var(--label2);padding:2px 8px 0;text-align:center}
.th-options.th-collapsed{left:auto;right:12px;padding:0;border-radius:22px;flex-direction:row}
.th-options.th-collapsed .th-options-pill{height:44px;padding:0 14px 0 16px;display:flex;align-items:center;gap:6px;font-size:15px;font-weight:600;color:var(--label);white-space:nowrap}
.th-options.th-collapsed .th-options-pill span{color:var(--th-gold-ink)}

/* ---------- 9. 输入栏 ---------- */
.th-composer{position:absolute;left:8px;right:8px;z-index:30;bottom:calc(max(12px, var(--sab) - 18px) + var(--th-keyboard-offset));border-radius:28px;padding:6px 8px 8px;display:flex;flex-direction:column;gap:4px}
.th-kb .th-composer{bottom:calc(var(--th-keyboard-offset) + 6px)}
.th-composer-controls{display:flex;align-items:center;gap:6px;min-height:44px;padding:0 2px 0 8px}
.th-identity{flex:1;min-width:0;display:flex;align-items:center;gap:6px;font-size:13px;font-weight:600;line-height:18px;color:var(--label2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.th-identity .th-av{width:20px;height:20px;font-size:10px}
.th-identity strong{color:var(--label);font-weight:600;overflow:hidden;text-overflow:ellipsis}
.th-director-toggle{display:flex;align-items:center;gap:8px;min-height:44px;padding:0 4px;font-size:13px;font-weight:600;color:var(--label)}
.th-auto-control{display:flex;align-items:center;gap:5px;height:36px;padding:0 12px;border-radius:18px;background:var(--fill);font-size:13px;font-weight:600;color:var(--label);position:relative;white-space:nowrap;flex:none}
.th-auto-control::before{content:"";position:absolute;inset:-4px 0}
.th-auto-control.th-running{background:var(--th-gold-fill);color:var(--th-gold-ink)}
.th-auto-control.th-stop-cap{background:rgba(255,59,48,.16);color:var(--red-t)}
.th-auto-progress{font-variant-numeric:tabular-nums}
.th-composer-row{display:flex;align-items:flex-end;gap:8px}
.th-composer-input{flex:1;min-width:0;min-height:44px;max-height:140px;padding:9px 16px;border-radius:22px;background:var(--fill);border:1.5px solid transparent;font-size:17px;line-height:24px;color:var(--label);overflow:hidden;overflow-wrap:anywhere}
.th-send,.th-stop{width:44px;height:44px;border-radius:50%;display:flex;align-items:center;justify-content:center;flex:none}
.th-send{background:var(--blue);color:#fff}
.th-send[disabled]{background:var(--fill2);color:var(--label3)}
.th-stop{background:var(--red);color:#fff}
.th-composer.th-directing .th-composer-input{border-color:var(--th-dir-border);border-style:dashed;background:var(--th-dir-bg)}
.th-dir-badge{display:flex;align-items:center;gap:5px;font-size:13px;font-weight:700;color:var(--th-dir-ink);white-space:nowrap}
.th-composer.th-directing .th-send{background:var(--th-dir-border);color:#1A1205}
.th-composer-status{display:flex;align-items:center;gap:6px;padding:2px 10px 0;font-size:12px;line-height:17px;color:var(--label2)}
.th-queue-notice{display:flex;align-items:center;gap:8px;margin:0 2px 2px;padding:8px 6px 8px 12px;border-radius:16px;background:var(--fill);font-size:13px;line-height:18px}
.th-queue-notice .th-grow{flex:1;min-width:0}
.th-queue-notice strong{display:block;font-weight:600;color:var(--label)}
.th-queue-notice span{display:block;color:var(--label2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.th-queue-notice button{width:44px;height:36px;display:flex;align-items:center;justify-content:center;color:var(--label2);flex:none}
.th-auto-banner{display:flex;align-items:center;gap:8px;margin:0 2px 2px;padding:8px 12px;border-radius:16px;font-size:13px;line-height:18px;background:var(--fill);color:var(--label)}
.th-auto-banner .th-grow{flex:1}

/* ---------- 10. 名单 ---------- */
.th-roster{display:flex;flex-direction:column;max-height:calc(844px - 120px)}
.th-roster-count{text-align:center;font-size:13px;color:var(--label2);margin:2px 0 12px}
.th-roster .search-bar{margin:0 0 10px}
.th-roster-group{margin-bottom:10px;border-radius:22px;overflow:hidden;background:var(--asbg)}
.th-roster-head{display:flex;align-items:center;gap:8px;width:100%;min-height:44px;padding:0 14px;font-size:13px;font-weight:600;color:var(--label2)}
.th-roster-head .th-grow{flex:1}
.th-roster-head svg{transition:transform .2s var(--ease)}
.th-roster-group.th-collapsed .th-roster-head svg{transform:rotate(-90deg)}
.th-roster-row{position:relative;display:flex;align-items:center;gap:12px;min-height:64px;padding:8px 4px 8px 14px}
.th-roster-row::before{content:"";position:absolute;top:0;left:62px;right:0;height:.5px;background:var(--sep)}
.th-roster-row .th-av{width:36px;height:36px;font-size:15px}
.th-roster-main{flex:1;min-width:0}
.th-roster-name{display:flex;align-items:center;gap:6px;font-size:16px;font-weight:600;line-height:22px;min-width:0}
.th-roster-name em{font-style:normal;font-weight:400;font-size:13px;color:var(--label2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.th-roster-note{font-size:13px;line-height:18px;color:var(--label2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:2px}
.th-roster-row .th-info{width:44px;height:44px;display:flex;align-items:center;justify-content:center;color:var(--label3);flex:none}
.th-source-tag{height:20px;padding:0 6px;border-radius:6px;font-size:11px;font-weight:700;line-height:20px;flex:none}
.th-source-tag.th-contact{background:var(--tint);color:var(--blue)}
.th-source-tag.th-local{background:var(--th-gold-fill);color:var(--th-gold-ink)}
.th-mentioned{height:20px;padding:0 6px;border-radius:6px;font-size:11px;font-weight:700;line-height:20px;flex:none;border:1px solid var(--label3);color:var(--label)}
.th-row-actions{display:flex;gap:8px;padding:0 14px 12px 62px;flex-wrap:wrap}
.th-row-actions button{height:36px;padding:0 14px;border-radius:18px;background:var(--fill);font-size:14px;font-weight:600;color:var(--blue);position:relative}
.th-row-actions button::before{content:"";position:absolute;inset:-4px 0}
.th-row-actions button.th-red{color:var(--red)}
.th-row-mem{display:flex;align-items:center;gap:10px;padding:0 14px 12px 62px;font-size:14px}
.th-row-mem .th-grow{flex:1}
.th-roster-summary{padding:0 14px 12px;font-size:13px;line-height:18px;color:var(--label2)}
.th-roster-row.th-expanded{background:var(--fill)}

/* ---------- 11. 角色详情 ---------- */
.th-character-detail .th-hero{display:flex;flex-direction:column;align-items:center;gap:8px;padding:6px 20px 8px;text-align:center}
.th-character-detail .th-hero .th-av{width:84px;height:84px;font-size:34px}
.th-character-detail .th-hero h2{margin:4px 0 0;font-size:22px;font-weight:700;line-height:30px}
.th-character-detail .th-hero .th-tags{display:flex;gap:6px;flex-wrap:wrap;justify-content:center}
.th-long{font-size:17px;line-height:26px;color:var(--label)}
.th-character-editor .cell.col.th-invalid{box-shadow:inset 0 0 0 1.5px var(--red);border-radius:26px}

/* ---------- 12. 世界书 ---------- */
.th-tidy-control{margin:0 16px 4px;padding:14px 16px;border-radius:22px;background:var(--card);display:flex;align-items:center;gap:12px}
.th-tidy-control .th-grow{flex:1;min-width:0}
.th-tidy-control strong{display:block;font-size:15px;font-weight:600;line-height:20px}
.th-tidy-control .btn{width:auto;min-height:40px;border-radius:20px;font-size:15px;padding:0 14px;flex:none}
.th-lore-entry{padding:14px 16px;position:relative}
.th-lore-entry+.th-lore-entry::before{content:"";position:absolute;top:0;left:16px;right:0;height:.5px;background:var(--sep)}
.th-lore-keys{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:8px}
.th-lore-title{display:flex;align-items:center;gap:6px;font-size:17px;font-weight:600;line-height:22px}
.th-lore-body{font-size:15px;line-height:22px;color:var(--label);margin-top:4px}
.th-lore-meta{font-size:12px;color:var(--label2);margin-top:8px}
.th-auto-tag{height:20px;padding:0 6px;border-radius:6px;font-size:11px;font-weight:700;line-height:20px;background:var(--th-gold-fill);color:var(--th-gold-ink);flex:none}
.th-superseded .th-lore-title,.th-superseded .th-lore-body{color:var(--label2)}
.th-superseded .th-lore-title s{text-decoration-thickness:1px}
.th-replaced-by{display:flex;gap:6px;align-items:flex-start;margin-top:8px;padding:8px 10px;border-radius:12px;background:var(--fill);font-size:13px;line-height:18px;color:var(--label2)}
.th-collapse-head{display:flex;align-items:center;gap:8px;width:100%;min-height:52px;padding:0 16px;font-size:17px;color:var(--label)}
.th-collapse-head .th-grow{flex:1}
.th-collapse-head svg.th-chev{color:var(--label3);transition:transform .2s var(--ease)}
.th-collapse-head[aria-expanded="true"] svg.th-chev{transform:rotate(90deg)}
.th-linked-book{display:flex;align-items:center;gap:12px;min-height:60px;padding:8px 8px 8px 16px;position:relative}
.th-linked-book+.th-linked-book::before{content:"";position:absolute;top:0;left:58px;right:0;height:.5px;background:var(--sep)}
.th-linked-book .th-book-ico{width:30px;height:30px;border-radius:8px;display:flex;align-items:center;justify-content:center;color:#fff;background:linear-gradient(180deg,#FFD84D,#FF9F0A);flex:none}
.th-linked-book .th-grow{flex:1;min-width:0}
.th-linked-book .th-grow div:first-child{font-size:17px;line-height:22px}
.th-linked-book .th-grow div:last-child{font-size:13px;color:var(--label2);display:flex;align-items:center;gap:4px}
.th-linked-book button{min-width:44px;height:44px;padding:0 8px;font-size:15px;color:var(--blue)}
.th-tidy-log{margin:0 16px;border-radius:26px;background:var(--card);overflow:hidden}
.th-tidy-record{padding:14px 16px;position:relative}
.th-tidy-record+.th-tidy-record::before{content:"";position:absolute;top:0;left:16px;right:0;height:.5px;background:var(--sep)}
.th-tidy-top{display:flex;align-items:center;gap:8px}
.th-tidy-top .th-grow{flex:1;font-size:15px;font-weight:600}
.th-tidy-top .th-subtle{white-space:nowrap}
.th-tidy-counts{display:flex;gap:6px;margin-top:8px;flex-wrap:wrap}
.th-tidy-counts span{height:26px;padding:0 10px;border-radius:13px;background:var(--fill);font-size:13px;line-height:26px;color:var(--label)}
.th-tidy-counts b{font-weight:700;font-variant-numeric:tabular-nums}
.th-tidy-record .th-undo{height:36px;padding:0 12px;border-radius:18px;background:var(--fill);font-size:14px;font-weight:600;color:var(--blue);position:relative;flex:none}
.th-tidy-record .th-undo::before{content:"";position:absolute;inset:-4px 0}
.th-tidy-record.th-undone .th-grow{color:var(--label2)}
.th-readonly{display:flex;align-items:center;gap:6px;margin:0 16px 10px;padding:10px 14px;border-radius:16px;background:var(--fill);font-size:13px;line-height:18px;color:var(--label2)}

/* ---------- 13. 房间设置 ---------- */
.th-room-settings .cell .th-unit{color:var(--label2);font-size:17px}
.th-room-settings .th-num-edit{width:64px;text-align:right;font-variant-numeric:tabular-nums;color:var(--label)}
.th-room-settings .cell.th-invalid .th-num-edit{color:var(--red-t)}
.th-seg-cell{padding:12px 16px;display:flex;flex-direction:column;gap:8px}
.th-prompt-edit{min-height:220px;font-size:15px!important;line-height:22px!important}

/* ---------- 14. 共享弹层附加作用域 ---------- */
.th-system-overlay .menu-item[aria-disabled="true"]{color:var(--label3);flex-direction:column;gap:0;line-height:20px;padding:6px 0}
.th-system-overlay .menu-item[aria-disabled="true"] small,.th-system-overlay .menu-item small{font-size:12px;color:var(--label2)}
.th-system-overlay .menu-item.th-busy{flex-direction:row;color:var(--label2)}
.th-system-overlay .ctx-item[aria-disabled="true"]{color:var(--label3)}
.th-system-overlay .ctx-item small{display:block;font-size:12px;color:var(--label2);line-height:16px}
.th-system-overlay .ctx-preview .th-line,.th-system-overlay .ctx-preview .th-narration{margin:0}
.th-ctx-card{border-radius:20px;padding:12px 14px;background:#1C2028;box-shadow:0 10px 30px rgba(0,0,0,.4)}
.th-edit-area{min-height:180px;max-height:360px;padding:12px 14px;border-radius:16px;background:var(--fill);font-size:17px;line-height:26px;color:var(--label);overflow:hidden}
.th-edit-meta{display:flex;justify-content:space-between;font-size:12px;color:var(--label2);padding:6px 4px 12px}

/* ---------- 15. 降级 ---------- */
@media (prefers-reduced-transparency: reduce){
  .th-app .glass,.th-system-overlay.sheet,.th-system-overlay .sheet,.th-system-overlay .alert,.th-system-overlay .ctx-menu,.th-options,.th-composer{-webkit-backdrop-filter:none!important;backdrop-filter:none!important}
  .th-app .glass,.th-options,.th-composer{background:var(--card)!important}
  .th-system-overlay.sheet,.th-system-overlay .sheet,.th-system-overlay .alert,.th-system-overlay .ctx-menu{background:var(--card)!important}
  .th-system-overlay .ctx-mask{-webkit-backdrop-filter:none;backdrop-filter:none;background:rgba(0,0,0,.6)}
}
.th-solid .glass,.th-solid .th-options,.th-solid .th-composer,.th-solid .sheet,.th-solid .alert{-webkit-backdrop-filter:none!important;backdrop-filter:none!important;background:var(--card)!important}
.th-solid .sheet-content>.menu-item,.th-solid .th-roster-group{background:var(--fill)!important}
@supports not ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))){
  .th-app .glass,.th-options,.th-composer,.th-system-overlay .sheet,.th-system-overlay .alert{background:var(--card)}
}
@media (prefers-reduced-motion: reduce){
  .th-app *,.th-system-overlay *{animation-duration:.001ms!important;animation-iteration-count:1!important;transition-duration:.001ms!important}
  .th-line.th-streaming .th-line-text::after{animation:none;opacity:1}
}

/* ---------- 16. 宽度适配 375–430 ---------- */
@media (max-width:375px){
  .th-narration-text{max-width:300px;font-size:17px;line-height:30px}
  .th-identity small{display:none}
}
@media (min-width:414px){.th-narration-text{max-width:350px}}

/* 第一批实际页面：滚动容器、表单与显隐。 */
.th-form .page-scroll{padding-bottom:calc(var(--sab) + 40px)}
.th-form .cell-edit{text-align:left;min-width:0}
.th-form textarea.cell-edit{min-height:96px;resize:vertical}
.th-form .th-field-error{padding:6px 0 0}
.th-form .th-invalid{box-shadow:inset 0 0 0 1px var(--red);border-radius:12px}
.th-pick-row{display:flex;align-items:center;gap:12px;width:100%;text-align:left;padding:14px 16px;color:var(--label)}
.th-pick-row>.th-av{width:40px;height:40px;font-size:17px}
.th-pick-main{flex:1;min-width:0;font-size:17px}
.th-pick-main small{display:block;font-size:13px;color:var(--label2);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-top:3px}
.th-pick-sub{padding-left:68px}
.th-pick-sub>.th-grow{flex:1}
.th-timeline{display:block;overflow-y:auto;overscroll-behavior:contain;overflow-anchor:none;scrollbar-width:thin}
.th-timeline>div{flex:none}
.th-narration.th-streaming .th-narration-text::after{content:'▏';color:var(--th-accent);animation:th-caret 1s steps(1) infinite}
.th-narration.th-waiting .th-line-wait{justify-content:center}
.th-stage .th-jump-latest,.th-stage .th-conn,.th-stage .th-options,.th-stage .th-stop,.th-stage .th-queue-notice,.th-stage .th-auto-banner{display:none}
.th-stage .th-jump-latest.show,.th-stage .th-conn.show,.th-stage .th-options.show,.th-stage .th-stop.show,.th-stage .th-queue-notice.show,.th-stage .th-auto-banner.show{display:flex}
.th-composer-input{resize:none;font-family:inherit;box-sizing:border-box;height:44px;overflow-y:auto}
.th-stage-nav .title>span{max-width:100%;overflow:hidden;text-overflow:ellipsis}
.th-options button:disabled,.th-auto-control:disabled{opacity:.5}
.th-options.th-collapsed>:not(.th-options-pill){display:none}
.th-options:not(.th-collapsed)>.th-options-pill{display:none}
.th-roster{max-height:70dvh;overflow-y:auto}
.th-roster-group.th-collapsed .th-roster-row{display:none}
.th-room-cover.th-no-cover .th-room-round{font:600 12px/24px var(--th-font-ui);color:#F2EEE6}
.th-room-cover>.th-tag{position:absolute;right:12px;top:12px}
.th-home-empty{padding-top:100px}
.th-stage .th-presence-event{white-space:normal;text-align:center}
.th-stage .th-line-name{overflow-wrap:anywhere}

/* 第二批：向导、管理页面与键盘中的弹层 */
.th-nav-space{width:44px;flex:none}
.th-app .th-grow{flex:1;min-width:0}
.th-wizard .page-scroll,.th-preview .page-scroll{padding-bottom:calc(130px + var(--th-keyboard-offset,0px) + var(--sab))}
.th-app .th-fields{border:0;margin:0;padding:0;min-width:0}
.th-app .th-actions-row>.btn{flex:1;min-width:0}
.th-app .th-wizard-actions .btn{margin:0}
.th-app .th-stepper input{width:44px;text-align:center;font:600 17px var(--th-font-ui);color:var(--label);background:transparent;border:0;appearance:textfield}
.th-app .th-stepper input::-webkit-inner-spin-button{appearance:none}
.th-app .th-wizard-summary{padding:20px;white-space:pre-wrap;overflow-wrap:anywhere;font-size:16px;line-height:25px}
.th-soft-progress{height:4px;overflow:hidden;border-radius:4px;background:var(--fill);margin:20px 0}
.th-soft-progress i{display:block;height:100%;width:35%;background:var(--blue);border-radius:4px;animation:th-indet 2.4s ease-in-out infinite}
.th-app .th-character-editor{padding:4px 0 12px;background:var(--fill)}
.th-preview .cell-edit,.th-character-detail .cell-edit{white-space:pre-wrap;overflow-wrap:anywhere}
.th-preview textarea.cell-edit{resize:none;overflow:hidden;min-height:70px}
.th-preview #thPreviewopening{font-family:var(--th-font-narration);line-height:1.8}
.th-app .th-cast-desc{white-space:pre-wrap;overflow-wrap:anywhere}
.th-app .th-truncate{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;min-width:0;flex:1}
.th-hit{background:var(--th-gold-fill);color:inherit;border-radius:2px}
.th-system-overlay .th-roster{overflow:hidden;max-height:min(72dvh,var(--th-sheet-height,72dvh))}
.th-roster-fixed{flex:none;padding-bottom:10px}
.th-roster-fixed .btn{min-height:40px;margin:0}
.th-roster-list,.th-add-list,.th-book-reader{overflow-y:auto;overscroll-behavior:contain;min-height:0}
.th-roster-list{flex:1}
.th-add-list{max-height:36dvh}
.th-book-reader{max-height:50dvh}
.th-system-overlay .th-roster-name{min-width:0}
.th-system-overlay .th-roster-row .th-info{flex:none}
.th-system-overlay .th-roster-group.th-collapsed .th-roster-summary{display:block}
.th-system-overlay .th-roster-group.th-collapsed .th-row-actions,.th-system-overlay .th-roster-group.th-collapsed .th-row-mem{display:none}
.th-system-overlay .th-edit-area{display:block;width:100%;box-sizing:border-box;border:0;resize:none;min-height:100px;height:26dvh;max-height:calc(var(--th-sheet-height,90dvh) - 240px);overflow:auto;font-family:inherit}
.th-system-overlay .th-actions-row{display:flex;gap:10px}
.th-system-overlay .th-actions-row .btn{flex:1;min-width:0;margin:0}
.th-system-overlay .th-field-error{padding:8px 4px;white-space:pre-wrap}
.th-system-overlay .th-edit-meta{padding:8px 4px}
.th-system-overlay .th-lore-editor{max-height:calc(var(--th-sheet-height,90dvh) - 180px);overflow:auto}
.th-system-overlay .th-lore-editor .cell-edit{box-sizing:border-box;width:100%;text-align:left;white-space:pre-wrap}
.th-system-overlay .th-lore-editor textarea{min-height:90px;resize:vertical}
.th-system-overlay .th-prompt-edit{max-height:calc(var(--th-sheet-height,90dvh) - 250px);min-height:100px!important;overflow:auto}
#sheet.th-system-overlay{bottom:var(--th-keyboard-offset,0px);max-height:var(--th-sheet-height,90dvh);overflow-y:auto}
.th-system-overlay .th-context-wrap{position:absolute;left:16px;right:16px;top:12%;max-height:80%;display:flex;flex-direction:column;align-items:flex-start;gap:14px}
.th-system-overlay .th-ctx-card{width:100%;box-sizing:border-box;min-height:80px;max-height:38dvh;overflow:auto;position:relative;flex:none}
.th-system-overlay .th-ctx-text{font-size:17px;line-height:28px;white-space:pre-wrap;overflow-wrap:anywhere;color:var(--th-stage-text)}
.th-system-overlay .th-context-wrap .ctx-menu{position:relative;left:auto;top:auto;max-width:100%;flex:none}
.th-system-overlay .ctx-item:disabled,.th-system-overlay .menu-item:disabled{opacity:.5}
.th-system-overlay .th-ctx-card .th-edit-meta{color:var(--th-stage-muted);font-size:13px}
.th-app .th-lore-fixed{position:absolute;top:calc(var(--top) + var(--navh));left:0;right:0;z-index:2;padding:0 16px;background:var(--pagebg)}
.th-app.th-lore-page .page-scroll{padding-top:calc(var(--top) + var(--navh) + 160px);padding-bottom:calc(30px + var(--sab))}
.th-app .th-tidy-control{margin:0 0 8px;padding:12px 16px}
.th-app .th-tidy-control .th-subtle,.th-app .th-readonly{display:block;margin-top:4px;font-size:13px}
.th-app .th-lore-fixed .th-save-status{padding:8px 0;font-size:13px;line-height:18px}
.th-app .th-lore-entry,.th-system-overlay .th-lore-entry{overflow-wrap:anywhere}
.th-app .th-lore-body,.th-system-overlay .th-lore-body{white-space:pre-wrap}
.th-app .th-lore-title,.th-system-overlay .th-lore-title{margin:4px 0 8px}
.th-app .th-text-btn{color:var(--blue);font-size:14px;padding:8px 12px 8px 0;min-height:36px}
.th-app .th-danger,.th-system-overlay .th-danger{color:var(--red-t)}
.th-app .th-book-lock{color:var(--label2);flex:none}
.th-app .th-linked-book .th-grow{overflow-wrap:anywhere}
.th-app .th-tidy-top{display:flex;gap:8px;flex-wrap:wrap}
.th-app .th-tidy-record .th-undo{display:block;margin:8px 0 0 auto;min-height:44px}
.th-app .th-long{white-space:pre-wrap;overflow-wrap:anywhere}
.th-app .th-av,.th-system-overlay .th-av{position:relative;overflow:hidden}
.th-avatar-image{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.th-app.th-room-settings .cell .value{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.th-app .model-item{width:100%;text-align:left}
.th-app .th-field-error:empty,.th-system-overlay .th-field-error:empty{padding:0}
@media (prefers-reduced-motion:reduce){.th-soft-progress i{animation:none;width:100%;opacity:.5}}
.th-form .th-save-status{padding:8px 32px;color:var(--label2);font-size:13px}
.th-form .th-save-status.th-error{color:var(--red-t)}

.th-stage .th-options{bottom:calc(var(--th-composer-height) + var(--th-keyboard-offset) + max(12px, var(--sab) - 18px) + 6px)}
.th-kb .th-stage .th-options{bottom:calc(var(--th-composer-height) + var(--th-keyboard-offset) + 12px)}
/* 角色详情里的记忆开关是普通表格行，不用名单行的头像缩进 */
#sub-theater-member .th-row-mem{padding:11px 16px;border-top:.5px solid var(--sep);font-size:17px}
/* 世界书页的“新增条目 / 挂上世界书”按钮与卡片同宽，不贴屏幕边 */
#thLoreBody>.btn{width:calc(100% - 32px);margin:12px 16px}
/* ---------- 剧场外观（全局，kv theater_look）：纸张背景 / 自定义图片背景 / 旁白字体 / 字号 ---------- */
.th-stage-bg{position:absolute;inset:0;display:none;background:#000 center/cover no-repeat}
.th-stage-bg::after{content:"";position:absolute;inset:0;background:#000;opacity:var(--th-bg-dim,.55)}
.th-stage.th-bg-image{background:#000}
.th-bg-image .th-stage-bg{display:block}
.th-bg-image .th-stage-nav{background:linear-gradient(rgba(0,0,0,.5),rgba(0,0,0,0))}
.th-bg-image .th-timeline{text-shadow:0 1px 2px rgba(0,0,0,.45)}
.th-stage.th-bg-paper{
  --th-stage-bg:#F4EEE2;--th-stage-surface:#EAE2D3;
  --th-stage-text:#2A251E;      /* on bg 13.2:1 */
  --th-stage-muted:#5C5447;     /* on bg 6.5:1 */
  --th-stage-faint:#6F6556;     /* on bg 4.9:1 */
  --th-stage-rule:#D6CCBA;--th-stage-edge:#8E8273;
  --th-accent:#8A5A0B;--th-user-accent:#2F5FA8;--th-error:#B3261E;--th-ok:#1E7B3C;
  background:radial-gradient(110% 38% at 50% -6%,rgba(196,150,80,.12),rgba(196,150,80,0) 70%),var(--th-stage-bg);
}
.th-bg-paper .th-stage-nav{background:linear-gradient(var(--th-stage-bg) 58%,rgba(244,238,226,0))}
.th-bg-paper .th-user-line{background:rgba(47,95,168,.07)}
.th-bg-paper .th-step-status{background:rgba(0,0,0,.04)}
.th-bg-paper .th-step-status .th-spinner{border-color:rgba(0,0,0,.12);border-top-color:var(--th-accent)}
.th-bg-paper .th-retry{background:rgba(138,90,11,.1)}
.th-bg-paper .th-scene-card.th-generating .th-progress{background:rgba(0,0,0,.1)}
.th-bg-paper .th-cam[aria-disabled="true"]{color:#9A9082}
.th-stage[data-font=serif]{--th-font-narration:"Source Han Serif CN VF","Songti SC","Noto Serif CJK SC","Noto Serif SC",serif}
.th-stage[data-font=wenkai]{--th-font-narration:"LXGW WenKai","Kaiti SC","STKaiti","KaiTi",serif}
.th-stage[data-font=fangsong]{--th-font-narration:"Zhuque Fangsong (technical preview)","STFangsong","FangSong",serif}
.th-stage.th-narr-sized .th-narration-text{font-size:var(--th-narr-size);line-height:calc(var(--th-narr-size) * 1.78)}
.th-stage.th-line-sized .th-line-text{font-size:var(--th-line-size);line-height:calc(var(--th-line-size) * 1.65)}
.sheet-mask.th-look-mask{background:transparent}
.th-look .th-look-label{font-size:13px;color:var(--label2);padding:4px 6px 8px}
.th-look .group{margin:0 0 14px}
.th-look-bgs{display:flex;gap:10px;overflow-x:auto;padding:3px 3px 12px;scrollbar-width:none}
.th-look-bgs::-webkit-scrollbar{display:none}
.th-look-bg{flex:none;width:62px;height:96px;border-radius:14px;position:relative;display:flex;align-items:flex-end;justify-content:center;padding:0 4px 8px;font-size:12px;font-weight:600;line-height:15px;background:center/cover no-repeat;box-shadow:0 0 0 .5px var(--sep)}
.th-look-bg.sel{box-shadow:0 0 0 2.5px var(--blue)}
.th-look-dark{background-color:#111318;color:#F2EEE6}
.th-look-paper{background-color:#F4EEE2;color:#2A251E}
.th-look-image{background-color:#222;color:#fff;text-shadow:0 1px 3px rgba(0,0,0,.8)}
.th-look-add{background:var(--fill);color:var(--label2);flex-direction:column;justify-content:center;align-items:center;gap:2px;padding:0}
.th-look-add svg{width:22px;height:22px}
.th-look-fonts{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:14px}
.th-look-font{min-height:52px;padding:6px 10px;border-radius:14px;background:var(--card);font-size:18px;line-height:24px;color:var(--label);box-shadow:inset 0 0 0 .5px var(--sep)}
.th-look-font.sel{box-shadow:inset 0 0 0 2px var(--blue);color:var(--blue)}
.th-look-note{font-size:12px;line-height:17px;color:var(--label2);padding:0 6px 12px}
.th-look .field-row .btn{margin-bottom:0}
.th-scene-media>.th-scene-image{display:block;width:100%;height:100%;object-fit:cover;cursor:zoom-in}
.th-scene-load{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;padding:16px;text-align:center;color:var(--th-stage-muted);background:var(--th-stage-surface);font-size:14px}
.th-scene-load[hidden]{display:none}
.th-scene-card.th-generating .th-scene-media>svg{position:static;width:26px;height:26px}
.th-scene-card.th-error .th-scene-media{aspect-ratio:16/9}
.th-scene-card.th-error .th-scene-media>span{max-height:90px;overflow:auto;overflow-wrap:anywhere}
.th-image-disabled .seg{opacity:.45}
.th-memory-note{display:block;margin-top:4px;white-space:normal}
/* 完成图按原比例显示、不裁剪：比例由 JS 写在 .th-scene-media 的 style 上（读到图片前用已知比例占位：漫画页 832×1216，旧场景图方图），读到图片后换成真实宽高 */
.th-scene-media>.th-scene-image{object-fit:contain}

/* ---------- 漫画剧场：作者正文（长文左对齐）+ 每轮一页漫画（全宽、原比例） ---------- */
.th-narration.th-prose{text-align:left;margin:18px 0 8px}
.th-prose .th-narration-text{max-width:none;margin:0;font-size:17px;line-height:30px;text-align:justify;text-wrap:wrap}
.th-prose .th-narration-text p+p{margin-top:12px}
.th-prose .th-say{color:var(--th-accent)}
.th-narration.th-prose.th-waiting .th-line-wait{justify-content:flex-start}
.th-narration.th-prose .th-cam{margin:4px 0 0 auto}
.th-scene-card.th-comic{margin:14px calc(-1 * var(--th-page-gutter)) 6px;border-radius:0;border-left:0;border-right:0}
.th-scene-card.th-comic.th-generating .th-scene-media{aspect-ratio:832/1216}
.th-scene-card.th-comic.th-error .th-scene-media{aspect-ratio:4/3}
.th-scene-card.th-comic .th-scene-caption{padding-left:calc(var(--th-page-gutter) + 2px)}

/* 剧场大图：双指缩放 / 拖动（JS 改 transform），浏览器自己的滚动和缩放关掉 */
.th-viewer{position:absolute;inset:0;z-index:96;display:flex;align-items:center;justify-content:center;overflow:hidden;background:#000;touch-action:none;user-select:none;-webkit-user-select:none;overscroll-behavior:contain}
.th-viewer[hidden]{display:none}
.th-viewer img{flex:none;max-width:100%;max-height:100%;object-fit:contain;transform-origin:50% 50%;will-change:transform;-webkit-user-drag:none;-webkit-touch-callout:none;pointer-events:auto}
.th-viewer-close{position:absolute;top:calc(var(--top) + 6px);right:12px;height:36px;padding:0 16px;border-radius:18px;background:rgba(40,40,44,.72);color:#fff;font-size:15px;font-weight:600;-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px)}
.th-viewer-hint{position:absolute;left:50%;bottom:calc(var(--sab) + 14px);transform:translateX(-50%);padding:4px 12px;border-radius:12px;background:rgba(0,0,0,.55);white-space:nowrap;font-size:12px;line-height:18px;color:rgba(255,255,255,.85);pointer-events:none}
/* 生图规则页：剧场漫画 LoRA 表（JSON，一项一行） */
.lora-text{min-height:300px;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12px;line-height:18px;white-space:pre-wrap;overflow-wrap:anywhere}
