*{box-sizing:border-box}
html,body{margin:0;background:#000;color:#fff;font-family:system-ui,-apple-system,"PingFang SC",sans-serif}
[hidden]{display:none!important}
button{font:inherit;color:inherit;cursor:pointer}
.demo-banner{position:fixed;top:0;left:0;right:0;z-index:30;padding:6px 12px;text-align:center;font-size:13px;background:#b45309;color:#fff}

#normal-view{min-height:100svh;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;padding:44px 16px 72px}
#normal-video,#normal-photo{display:block;width:100%;max-width:480px;max-height:62svh;object-fit:contain;background:#111}
#normal-video[hidden],#normal-photo[hidden]{display:none}
#normal-photo{width:auto;max-width:100%;max-height:48svh;background:none;border-radius:12px}   /* 2026-11-10 项目方「上面的人物调小点」：62 → 48svh，两个按钮不用往下找 */
.primary{padding:14px 26px;border:0;border-radius:10px;background:#fff;color:#111;font-weight:600;font-size:17px}
.primary:disabled{opacity:.6}
.hint{margin:0;font-size:13px;color:#aaa;text-align:center}
.message{margin:0;max-width:480px;padding:10px 14px;border:1px solid #666;border-radius:8px;text-align:center;font-size:15px}

#ar-view{position:fixed;inset:0;z-index:20;background:#000;touch-action:none}
/* !important：three.js 的 renderer.setSize 会把行内样式写成像素尺寸（实测 iPhone 上为 2 倍视口），画面被放大、中心跑到右下角 */
#ar-canvas,#stage-canvas{position:absolute;inset:0;width:100% !important;height:100% !important;display:block}
/* 手机直接聊天：不开摄像头，背景是柔和的渐变（2026-11-10） */
#ar-view.stage{background:radial-gradient(70% 38% at 50% 46%,rgba(255,252,249,.85) 0%,rgba(255,252,249,0) 100%),linear-gradient(180deg,#fbf6f3 0%,#f8efeb 46%,#f4e8e6 54%,#f0e3e3 100%)}   /* 2026-11-11 项目方「背景要再淡一些 太抢眼」：女性暖白；地面和光点在 stage-xr.js
#ar-view.stage.stage-m{background:radial-gradient(70% 38% at 50% 46%,rgba(250,252,255,.85) 0%,rgba(250,252,255,0) 100%),linear-gradient(180deg,#f4f6f8 0%,#eef1f4 46%,#e8ecf0 54%,#e3e7ec 100%)}   /* 男性：冷灰蓝（项目方「男性的背景要不一样的吧」） */
.secondary{padding:12px 22px;border:1px solid rgba(255,255,255,.8);border-radius:10px;background:transparent;color:#fff;font-size:16px}
#chat-button{margin-top:10px}
/* 首页两个按钮一样大（2026-11-11 项目方「两个框大小要一样的，一大一小不协调」）：同宽、同高、同字号，白的是实心、下面是描边 */
#normal-view #ar-button,#normal-view #chat-button{box-sizing:border-box;width:min(260px,78vw);height:52px;padding:0 16px;border-radius:12px;font-size:17px;font-weight:600;line-height:1}
#normal-view #ar-button{border:1px solid #fff}
.ar-top{position:absolute;top:36px;left:12px;right:12px;display:flex;justify-content:space-between;gap:8px}
.ar-top button,.ar-bottom button{padding:10px 16px;border:1px solid #fff;border-radius:999px;background:rgba(0,0,0,.55)}
.ar-tip{position:absolute;left:16px;right:16px;bottom:96px;pointer-events:none;margin:0;padding:10px 14px;border-radius:10px;background:rgba(0,0,0,.6);text-align:center;font-size:15px}
.ar-bottom{position:absolute;left:0;right:0;bottom:36px;display:flex;justify-content:center;align-items:center;gap:16px}

#debug{position:fixed;left:0;right:0;top:88px;z-index:40;max-height:22svh;pointer-events:none;opacity:.85;overflow:auto;margin:0;padding:8px;font-size:11px;line-height:1.4;background:rgba(0,0,0,.8);color:#9f9;white-space:pre-wrap}
.attribution{position:relative;z-index:10;padding:12px 16px 24px;font-size:11px;line-height:1.5;color:#888;text-align:center}
.attribution a{color:#bbb}
#ar-view:not([hidden]) ~ .attribution{position:fixed;left:0;right:0;bottom:0;z-index:25;padding:4px 8px;font-size:9px;background:rgba(0,0,0,.4)}
.attr-toggle{display:none}
/* AR 画面里：版权说明收成右下角一个小「ⓘ」，点开显示全文（许可要求注明出处、版权、许可协议和免责，放在点开里仍然在） */
#ar-view:not([hidden]) ~ .attribution:not(.open){left:auto;right:6px;bottom:6px;padding:0;background:none;font-size:0;color:transparent}
#ar-view:not([hidden]) ~ .attribution:not(.open) a{display:none}
#ar-view:not([hidden]) ~ .attribution .attr-toggle{display:inline-block;width:22px;height:22px;padding:0;border:0;border-radius:50%;background:rgba(0,0,0,.25);color:rgba(255,255,255,.7);font-size:13px;line-height:22px}
#ar-view:not([hidden]) ~ .attribution.open .attr-toggle{float:right;margin-left:6px}
/* 直接聊天不用 AR 引擎，不需要这段说明 */
#ar-view.stage:not([hidden]) ~ .attribution{display:none}
.photo-button{padding:14px 22px!important;font-weight:600;background:#fff!important;color:#111}
.photo-preview{position:absolute;inset:0;z-index:7;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;padding:40px 16px;background:rgba(0,0,0,.92)}   /* 盖住好感度（z 6）：2026-11-09 真机截图好感度压在录像预览上 */
.photo-preview img{max-width:100%;max-height:68svh;border-radius:8px;box-shadow:0 0 0 1px #444}
.photo-actions{display:flex;gap:12px}
.photo-actions button:not(.primary){padding:14px 22px;border:1px solid #fff;border-radius:10px;background:transparent}
.record-button{padding:14px 18px!important;font-weight:600;background:#ff4d7d!important;border-color:#ff4d7d!important}
.record-button.recording{background:#b00020!important;border-color:#fff!important}
.photo-preview video{max-width:100%;max-height:68svh;border-radius:8px;background:#000}
.ar-bottom{gap:10px!important}

/* AI 对话 */
.ar-chat{position:absolute;left:0;right:0;bottom:184px;display:flex;justify-content:center;gap:10px}
.ar-chat button{padding:12px 20px;border:1px solid #fff;border-radius:999px;background:rgba(255,77,125,.85);color:#fff;font-size:16px}
.ar-chat button:disabled{opacity:.55}
.ar-chat button.on{background:rgba(176,0,32,.9)}
.ar-chat button.listening{background:#e0245e;box-shadow:0 0 0 6px rgba(255,77,125,.35)}
.ar-heard{position:absolute;left:24px;right:24px;bottom:240px;margin:0;padding:8px 12px;border-radius:10px;background:rgba(0,0,0,.5);color:#fff;font-size:14px;text-align:right;pointer-events:none;white-space:pre-line}
.ar-affection{position:absolute;top:96px;right:12px;z-index:6;padding:6px 12px;border-radius:999px;background:rgba(255,77,125,.85);color:#fff;font-size:14px;pointer-events:none}
.ar-affection.bump{animation:bump .6s}
@keyframes bump{30%{transform:scale(1.35)}}

/* 2026-11-03 按钮遮挡（USB 真机截图：「开始聊天」离底 184px，正好压在人物小腿和脚上；提示条、识别文字也叠在下半屏）：
   屏幕中下部全部空给人物——「开始聊天」并到最底一排（左），拍照 / 录像靠右；提示条、识别到的话移到顶栏下面 */
.ar-chat{bottom:36px;left:12px;right:auto;justify-content:flex-start}
.ar-chat button{padding:14px 18px;font-size:15px}
#ar-view:has(#ar-chat:not([hidden])) .ar-bottom{justify-content:flex-end;padding-right:12px}
.ar-tip{bottom:auto;top:92px;left:12px;right:112px;padding:6px 10px;font-size:13px;text-align:left}
.ar-heard{bottom:auto;top:140px;font-size:13px}
/* 底排整行宽、盖在「开始聊天」上会拦住点击（桌面测试 TimeoutError：ar-size intercepts pointer events）→ 整行不接点击，只有按钮接 */
.ar-bottom{pointer-events:none}
.ar-bottom button{pointer-events:auto}
/* 2026-11-03 USB 真机：手机离卡近时人头顶到屏幕上方，移到顶部的提示条 / 识别文字压在脸上 → 放回底排按钮上方、单行小字，并自动淡出（app.js） */
.ar-tip{top:auto;bottom:100px;left:12px;right:12px;padding:5px 10px;font-size:12px;text-align:center;transition:opacity .4s}
.ar-heard{top:auto;bottom:132px;font-size:12px;padding:5px 10px;transition:opacity .4s}
.ar-tip.faded,.ar-heard.faded{opacity:0}
/* 聊天状态点（2026-11-08）：在听 绿色呼吸 / 听清了在想 黄色闪 / 在说 粉色 */
.ar-tip[data-state]::before{content:"";display:inline-block;width:8px;height:8px;border-radius:50%;margin-right:6px;vertical-align:1px;background:#5ad67d}
.ar-tip[data-state=listening]::before{animation:tipPulse 1.4s ease-in-out infinite}
.ar-tip[data-state=thinking]::before{background:#ffc145;animation:tipPulse .7s ease-in-out infinite}
.ar-tip[data-state=speaking]::before{background:#ff6fa3}
@keyframes tipPulse{0%,100%{opacity:1;transform:scale(1)}50%{opacity:.35;transform:scale(.7)}}

/* 扫卡资料页（2026-11-05） */
.profile-sheet{position:fixed;inset:0;z-index:40;overflow:auto;padding:28px 18px 40px;background:rgba(10,10,14,.96);color:#fff;font-size:15px}
.profile-sheet h2{margin:0 0 16px;font-size:20px}
.profile-sheet label{display:block;margin:0 0 14px}
.profile-sheet input{display:block;width:100%;box-sizing:border-box;margin-top:6px;padding:10px;border-radius:8px;border:1px solid #555;background:#1c1c22;color:#fff;font-size:16px}
.profile-sheet p{margin:14px 0 8px}
.pf-chips{display:flex;flex-wrap:wrap;gap:8px}
.pf-chips button{padding:8px 12px;border-radius:18px;border:1px solid #666;background:transparent;color:#ddd;font-size:14px}
.pf-chips button.on{background:#e65a8a;border-color:#e65a8a;color:#fff}
.pf-listen{margin-left:8px;padding:4px 10px;border-radius:12px;border:1px solid #888;background:transparent;color:#fff;font-size:13px}
.pf-actions{display:flex;gap:10px;margin-top:24px}
.pf-actions button{flex:1;padding:12px;border-radius:10px;font-size:16px}
#pf-skip{background:transparent;border:1px solid #666;color:#ccc}

/* 资料页「我的声音」录音面板（2026-11-07） */
.pf-rec{margin:12px 0 4px;padding:12px;border:1px solid #444;border-radius:10px;background:#16161c;font-size:14px;line-height:1.5}
.pf-rec p{margin:0 0 8px}
.pf-rec ul{margin:0 0 10px;padding-left:18px;color:#ccc}
.pf-rec li{margin-bottom:4px}
.profile-sheet .pf-agree{display:flex;align-items:center;gap:10px;margin:0 0 12px;font-size:15px}
.profile-sheet .pf-agree input{display:inline-block;width:22px;height:22px;margin:0;flex:none}
.pf-rec button{padding:9px 14px;border-radius:18px;border:1px solid #888;background:transparent;color:#fff;font-size:14px}
.pf-rec button.primary{background:#e65a8a;border-color:#e65a8a}
.pf-rec button:disabled{opacity:.4}
.pf-rec-line{font-size:18px;font-weight:600;color:#fff}
.pf-rec-time{color:#e65a8a;font-variant-numeric:tabular-nums}
.pf-rec-msg{color:#ffb4c8}
.pf-rec-ok{color:#7ee0a0}
.pf-rec-btns{display:flex;gap:10px}
.pf-rec-col{flex-direction:column;align-items:stretch}
.pf-rec-tip{margin-top:10px!important;color:#aaa;font-size:13px}
.pf-rec-used{color:#ccc;font-size:13px}
/* 按下去的效果（2026-11-07 项目方「点击要有点击的效果 不然让别人很容易误解没有点击成功」） */
.profile-sheet button{transition:transform .08s,opacity .08s,background-color .15s;-webkit-tap-highlight-color:transparent}
.profile-sheet button:active:not(:disabled){transform:scale(.94);opacity:.75}
.pf-listen:disabled{opacity:.7}

.pre .demo-banner,.pre #normal-view{visibility:hidden}   /* 扫卡模式首页在 app.js 设好前不露出，见 index.html */

/* ===== 预览（网址带 pv=1，<html class="pv">；2026-11-11 项目方确认后再转正） ===== */
/* 首页两个按钮和人物照片一样宽、矮一点（项目方「等于和上面的人物框一样宽，现在太大了」）；宽度由 app.js 量照片写进 --photo-w */
.pv #normal-view #ar-button,.pv #normal-view #chat-button{width:var(--photo-w,160px);height:44px;padding:0 8px;border-radius:10px;font-size:16px}
.pv #chat-button{margin-top:4px}
/* 直接聊天背景：人像影棚——无缝背景纸（上浅下略深，没有地平线）+ 身后一团柔光 + 四角轻暗角 + 细颗粒（防色带、有质感） */
.pv #ar-view.stage{background:
  url(ar/grain.png),
  radial-gradient(120% 90% at 50% 42%,rgba(0,0,0,0) 55%,rgba(96,72,52,.13) 100%),
  radial-gradient(60% 34% at 50% 34%,rgba(255,251,245,.9) 0%,rgba(255,251,245,0) 100%),
  linear-gradient(180deg,#f3ede6 0%,#efe6dc 40%,#e9ded2 62%,#e2d5c7 100%)}
.pv #ar-view.stage.stage-m{background:
  url(ar/grain.png),
  radial-gradient(120% 90% at 50% 42%,rgba(0,0,0,0) 55%,rgba(40,52,66,.14) 100%),
  radial-gradient(60% 34% at 50% 34%,rgba(250,252,255,.9) 0%,rgba(250,252,255,0) 100%),
  linear-gradient(180deg,#eef0f2 0%,#e8ebee 40%,#e1e5e9 62%,#d9dee3 100%)}
/* 聊天条移到「结束聊天」右边（项目方「移动到结束聊天框的右侧，这样上面空间大起来」）：听到的话在上、状态在下，靠右对齐 */
.pv #ar-view.stage .ar-tip{left:auto;right:12px;bottom:40px;top:auto;width:calc(100% - 172px);max-width:340px;padding:6px 10px;font-size:12px;text-align:left;border-radius:10px;background:rgba(40,32,28,.55)}
.pv #ar-view.stage .ar-heard{left:auto;right:12px;bottom:78px;top:auto;width:calc(100% - 172px);max-width:340px;padding:6px 10px;font-size:12px;text-align:left;border-radius:10px;background:rgba(40,32,28,.45)}
/* 直接聊天的按钮跟着背景走（浅色影棚上深灰按钮、亮粉按钮显得廉价）：顶部按钮和聊天条改半透明磨砂白、深色字；聊天按钮深玫瑰（男性深蓝灰） */
.pv #ar-view.stage .ar-top button{background:rgba(255,255,255,.55);color:#3b3029;border:1px solid rgba(255,255,255,.85);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);box-shadow:0 2px 10px rgba(70,45,30,.08)}
.pv #ar-view.stage .ar-tip,.pv #ar-view.stage .ar-heard{background:rgba(255,255,255,.62);color:#3b3029;border:1px solid rgba(255,255,255,.8);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);box-shadow:0 2px 10px rgba(70,45,30,.06)}
.pv #ar-view.stage .ar-chat button{background:linear-gradient(135deg,#bd5a70,#96344c);border:1px solid rgba(255,255,255,.6);box-shadow:0 6px 18px rgba(150,52,76,.28)}
.pv #ar-view.stage .ar-chat button.on{background:linear-gradient(135deg,#a63d55,#7d2338)}
.pv #ar-view.stage .ar-affection{background:rgba(255,255,255,.62);color:#96344c;border:1px solid rgba(255,255,255,.85);-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px)}
.pv #ar-view.stage.stage-m .ar-chat button{background:linear-gradient(135deg,#4f6a82,#2f465c);box-shadow:0 6px 18px rgba(47,70,92,.28)}
.pv #ar-view.stage.stage-m .ar-chat button.on{background:linear-gradient(135deg,#3e566c,#243649)}
.pv #ar-view.stage.stage-m .ar-affection{color:#2f465c}
/* 直接聊天加录像（2026-11-11 项目方「在这里加一个开始录像」，截图箭头指在「结束聊天」下面）：录像按钮放在聊天按钮正下方，聊天按钮和右边聊天条一起往上挪一格 */
.pv #ar-view.stage .ar-bottom{left:12px;right:auto;bottom:30px;justify-content:flex-start;padding:0}
.pv #ar-view.stage .ar-chat{bottom:88px}
.pv #ar-view.stage .ar-tip{bottom:92px}
.pv #ar-view.stage .ar-heard{bottom:130px}
.pv #ar-view.stage .record-button{padding:10px 18px!important;font-size:14px;background:rgba(255,255,255,.62)!important;color:#96344c;border:1px solid rgba(255,255,255,.85)!important;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);box-shadow:0 2px 10px rgba(70,45,30,.08)}
.pv #ar-view.stage .record-button::before{content:"";display:inline-block;width:9px;height:9px;margin-right:7px;border-radius:50%;background:#d23a5a;vertical-align:1px}
.pv #ar-view.stage .record-button.recording{background:#b00020!important;color:#fff;border-color:#fff!important}
.pv #ar-view.stage .record-button.recording::before{background:#fff;animation:tipPulse 1s infinite}
.pv #ar-view.stage.stage-m .record-button{color:#2f465c}
/* 首页的版权说明也收成右下角小「ⓘ」（2026-11-11 项目方截图「这里显示的AR信息的，和AR里面一样收起来」），点一下展开、再点收起；AR 画面里原规则不变 */
#ar-view[hidden] ~ .attribution{position:fixed;left:0;right:0;bottom:calc(env(safe-area-inset-bottom) + 6px);z-index:25;padding:6px 10px;font-size:10px;background:rgba(0,0,0,.7)}
#ar-view[hidden] ~ .attribution:not(.open){left:auto;right:8px;padding:0;background:none;font-size:0;color:transparent}
#ar-view[hidden] ~ .attribution:not(.open) a{display:none}
#ar-view[hidden] ~ .attribution .attr-toggle{display:inline-block;width:22px;height:22px;padding:0;border:0;border-radius:50%;background:rgba(255,255,255,.12);color:rgba(255,255,255,.6);font-size:13px;line-height:22px}
#ar-view[hidden] ~ .attribution.open .attr-toggle{float:right;margin-left:6px}
/* 直接聊天底部再排一次（2026-11-11 项目方截图）：「开始 / 结束聊天」缩小约 8%；「开始录像」和它一样大小、一样圆角，上下对齐；
   右边两条（你说的话 / 状态）各对齐一个按钮；整体紧凑、往下移 */
.pv #ar-view.stage .ar-chat{left:12px;bottom:72px}
.pv #ar-view.stage .ar-chat button{box-sizing:border-box;width:124px;height:44px;padding:0 12px;font-size:14px;white-space:nowrap}
.pv #ar-view.stage .ar-bottom{left:12px;bottom:20px;gap:0}
.pv #ar-view.stage .record-button{box-sizing:border-box;width:124px;height:44px;padding:0 12px!important;border-radius:999px;font-size:14px;white-space:nowrap}
.pv #ar-view.stage .ar-heard{left:146px;right:12px;width:auto;max-width:none;bottom:79px;min-height:30px;display:flex;align-items:center}
.pv #ar-view.stage .ar-tip{left:146px;right:12px;width:auto;max-width:none;bottom:27px;min-height:30px;display:flex;align-items:center}
/* 一键授权卡片（2026-11-11） */
#perm-sheet{position:fixed;inset:0;z-index:40;display:flex;align-items:flex-end;justify-content:center;background:rgba(0,0,0,.55);padding:0 16px calc(env(safe-area-inset-bottom) + 24px)}
#perm-sheet .perm-card{width:min(420px,100%);padding:22px 20px 18px;border-radius:18px;background:#1c1c1e;color:#fff;text-align:center;box-shadow:0 10px 30px rgba(0,0,0,.4)}
#perm-sheet h3{margin:0 0 10px;font-size:18px}
#perm-sheet p{margin:0 0 18px;font-size:14px;line-height:1.6;color:#ccc}
#perm-sheet button{width:100%;height:46px;font-size:16px}
