/* ============================================================
 * 安安网页 v1.2 排练场 - 全屏桌面伴侣界面（无样机框版）
 * ------------------------------------------------------------
 * 目标：整页即"成品数字伙伴界面"——立绘当主角，UI 浮于虚化背景之上
 * 分区（100dvh 全屏自适应，零页面滚动）：
 *   顶栏玻璃状态条 → 主区（左·立绘大舞台 + 右·伴侣面板） → 精简 ANAN OS 底栏
 * 美学：暗色暖调 + 毛玻璃 backdrop-filter + 圆角卡片 + 柔和阴影 + 呼吸辉光
 * 约束：纯静态、相对引用、零明文；kiosk 一屏容纳零滚动
 * JS 契约（不可改名）：#anan-figure/.blink、#bubble/.show、.tap-hint/.hide、
 *   .mood-btn/.on、#mood-auto/.off/.spinning、.st-mood、[data-mood]、#l2d-canvas
 * 动画契约：breathe / blinkAnim / talkPulse / spin / msgIn / moodGlow
 * ============================================================ */

/* ---------- 0. 变量与基础重置 ---------- */
:root {
  --ink: #ffeef2;                       /* 主文字（浅色，浮于暗背景） */
  --ink-dim: rgba(255, 224, 231, .62);
  --rose: #ff7fa5;                      /* 主强调色（玫瑰粉） */
  --rose-deep: #ff6d93;
  --rose-soft: #ffb7c9;
  --card-radius: 24px;
  --glass-bg: linear-gradient(135deg, rgba(255, 255, 255, .13), rgba(255, 255, 255, .06));
  --glass-line: 1px solid rgba(255, 255, 255, .2);
  --shadow-card: 0 18px 48px rgba(14, 6, 10, .45), inset 0 1px 0 rgba(255, 255, 255, .16);
  --gap: 18px;
}

html, body {
  height: 100%; margin: 0;
  overflow: hidden;                     /* kiosk：整页零滚动条 */
  user-select: none;
}
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  background: #241a1e;                  /* 背景图加载前的暖暗底色 */
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

/* ---------- 1. 整页背景：立绘虚化暗化版 + 渐暗蒙层（可读性保底） ---------- */
.page-bg {
  position: fixed; inset: 0; z-index: -2;
  background: url("assets/anan_bg.jpg") center / cover no-repeat;
  filter: saturate(1.05);
  transform: scale(1.04);               /* 边缘留量，避免滤镜露边 */
}
.page-scrim {
  position: fixed; inset: 0; z-index: -1;
  /* 顶部/底部渐暗 + 中央微暗 + 四角暗角：保证浮层文字可读 */
  background:
    linear-gradient(180deg, rgba(22, 12, 17, .58) 0%, rgba(22, 12, 17, .18) 26%,
                            rgba(22, 12, 17, .2) 58%, rgba(22, 12, 17, .66) 100%),
    radial-gradient(120% 90% at 50% 42%, rgba(24, 13, 18, 0) 42%, rgba(24, 13, 18, .42) 100%);
}

/* ---------- 2. 毛玻璃工具类 ---------- */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(22px) saturate(1.5);
  -webkit-backdrop-filter: blur(22px) saturate(1.5);
  border: var(--glass-line);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-card);
}

/* ---------- 3. 全屏骨架：顶栏 / 主区 / 底栏 ---------- */
body {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: var(--gap);
  padding: calc(14px + env(safe-area-inset-top)) calc(18px + env(safe-area-inset-right))
           calc(12px + env(safe-area-inset-bottom)) calc(18px + env(safe-area-inset-left));
  box-sizing: border-box;
}

/* ===== 3.1 顶栏：玻璃状态条（悬浮胶囊居中） ===== */
.top-bar { display: flex; justify-content: center; }
.status-pill {
  display: inline-flex; align-items: center; gap: 14px;
  padding: 9px 22px; border-radius: 999px;
  font-size: 14px;
}
.st-time {
  font-weight: 600; letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .35);
}
.st-divider { width: 1px; height: 14px; background: rgba(255, 255, 255, .3); }
.st-mood { font-size: 13.5px; color: var(--ink); border-radius: 999px; transition: box-shadow .4s; }
.st-right { display: inline-flex; gap: 8px; font-size: 13px; opacity: .9; }
.ico { filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .3)); }
/* 情绪联动：状态条 chip 按当前情绪描边变色（沿 v1.1 语义，色值适配新主题） */
[data-mood="happy"]   .st-mood { box-shadow: inset 0 0 0 1px rgba(255, 158, 120, .6); }
[data-mood="talking"] .st-mood { box-shadow: inset 0 0 0 1px rgba(255, 199, 128, .6); }
[data-mood="sleepy"]  .st-mood { box-shadow: inset 0 0 0 1px rgba(150, 170, 255, .5); }

/* ===== 3.2 主区：左舞台 + 右面板 ===== */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(330px, .85fr);
  gap: var(--gap);
  min-height: 0;
}

/* ---------- 立绘舞台（视觉主焦点） ---------- */
.stage-wrap { position: relative; min-height: 0; }
/* 舞台后方的柔光氛围（玫瑰辉光，暗示"主角登场"） */
.stage-wrap::before {
  content: ""; position: absolute; inset: -26px; z-index: -1;
  background: radial-gradient(58% 58% at 50% 46%, rgba(255, 128, 158, .2), transparent 70%);
  filter: blur(10px); pointer-events: none;
}
#stage {
  position: relative; height: 100%; min-height: 0;
  overflow: hidden; border-radius: var(--card-radius);
  background: rgba(255, 255, 255, .05);
  border: var(--glass-line);
  box-shadow: var(--shadow-card);
  cursor: pointer;
}
/* 主立绘：cover 撑满舞台，脸部置上（构图偏上 22%） */
#anan-figure {
  position: absolute; inset: 0; z-index: 1;
  width: 100%; height: 100%;
  object-fit: cover; object-position: 50% 22%;
  animation: breathe var(--breathe-dur, 3.6s) ease-in-out infinite;
  transition: filter .5s ease;
}
/* 舞台内侧顶部/底部渐暗，让浮层与情绪坞更清晰 */
#stage::after {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: linear-gradient(180deg, rgba(20, 10, 14, .3) 0%, rgba(20, 10, 14, 0) 22%,
                              rgba(20, 10, 14, 0) 62%, rgba(20, 10, 14, .5) 100%);
}

/* 情绪语义滤镜锚点（mood.js 驱动 html[data-mood]；滤镜值沿 v1.1） */
[data-mood="happy"]   #anan-figure { --breathe-dur: 2.6s; filter: brightness(1.07) saturate(1.12); }
[data-mood="idle"]    #anan-figure { --breathe-dur: 3.6s; filter: brightness(1) saturate(1); }
[data-mood="talking"] #anan-figure { animation: talkPulse 1.6s ease-in-out infinite; }
[data-mood="sleepy"]  #anan-figure { --breathe-dur: 6.5s; filter: brightness(.85) saturate(.75) hue-rotate(8deg); }

/* 眨眼（app.js 随机触发 .blink） */
#anan-figure.blink { animation: blinkAnim .22s ease-in-out 1; filter: brightness(.92); }
@keyframes blinkAnim {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50%      { transform: scale(1.004); filter: brightness(.88); }
}
/* 呼吸（#anan-figure 与回退 #l2d-canvas 共用） */
@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.014); }
}
/* 说话：亮度脉冲 */
@keyframes talkPulse {
  0%, 100% { filter: brightness(1.04) saturate(1.04); }
  50%      { filter: brightness(1.12) saturate(1.08); }
}

/* 冒泡语录：悬浮玻璃气泡（带小尾巴） */
.bubble {
  position: absolute; left: 50%; top: 9%; z-index: 6;
  transform: translateX(-50%) translateY(6px) scale(.96);
  max-width: min(78%, 420px);
  padding: 10px 16px; border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 255, 255, .9), rgba(255, 236, 241, .86));
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  color: #7c3f4c; font-size: 14px; line-height: 1.55; text-align: center;
  box-shadow: 0 10px 30px rgba(20, 8, 12, .35), inset 0 1px 0 rgba(255, 255, 255, .6);
  opacity: 0; pointer-events: none;
  transition: opacity .32s ease, transform .32s ease;
}
.bubble::after {           /* 气泡尾巴 */
  content: ""; position: absolute; left: 50%; bottom: -7px;
  width: 14px; height: 14px; margin-left: -7px;
  background: rgba(255, 240, 244, .88);
  transform: rotate(45deg); border-radius: 3px;
}
.bubble.show { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }

/* 触控示意："轻点我"（首次点击后 .hide 淡出） */
.tap-hint {
  position: absolute; left: 50%; bottom: 78px; z-index: 6;
  transform: translateX(-50%);
  padding: 7px 16px; border-radius: 999px; white-space: nowrap;
  background: rgba(30, 16, 20, .5); color: var(--rose-soft);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 183, 201, .35);
  font-size: 12.5px; letter-spacing: 1.5px;
  pointer-events: none;             /* v1.5 B2：视觉提示不拦截点击——点击穿透到立绘，语录+TTS 照常触发 */
  animation: hintBreath 2.2s ease-in-out infinite;
  transition: opacity .5s ease;
}
.tap-hint.hide { opacity: 0; pointer-events: none; }
@keyframes hintBreath {
  0%, 100% { opacity: .8; transform: translateX(-50%) translateY(0); }
  50%      { opacity: 1;  transform: translateX(-50%) translateY(-3px); }
}

/* ---------- 情绪坞：四情绪钮 + 自动轮播开关（悬浮舞台底部） ---------- */
.mood-dock {
  position: absolute; left: 50%; bottom: 16px; z-index: 7;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 999px;
  background: rgba(28, 16, 20, .48);
  backdrop-filter: blur(16px) saturate(1.4); -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, .18);
  box-shadow: 0 10px 28px rgba(14, 6, 10, .4);
}
.mood-btn {
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .22);
  background: rgba(255, 255, 255, .08);
  color: var(--ink); font-size: 20px; line-height: 1;
  cursor: pointer; transition: transform .18s ease, background .25s ease, box-shadow .25s ease;
}
.mood-btn:hover { transform: translateY(-3px); background: rgba(255, 255, 255, .16); }
.mood-btn:active { transform: scale(.9); }
.mood-btn.on {                                  /* 状态高亮 + 呼吸辉光 */
  background: linear-gradient(135deg, var(--rose), var(--rose-deep));
  border-color: rgba(255, 255, 255, .45);
  box-shadow: 0 0 0 0 rgba(255, 128, 165, .55);
  animation: moodGlow 2s ease-in-out infinite;
}
@keyframes moodGlow {
  0%, 100% { box-shadow: 0 0 10px 2px rgba(255, 128, 165, .35), 0 4px 14px rgba(255, 109, 147, .3); }
  50%      { box-shadow: 0 0 20px 5px rgba(255, 128, 165, .55), 0 4px 20px rgba(255, 109, 147, .45); }
}
.mood-auto {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px dashed rgba(255, 255, 255, .4);
  background: transparent; color: var(--ink); font-size: 16px;
  cursor: pointer; transition: opacity .3s ease, transform .3s ease;
}
.mood-auto:hover { transform: translateY(-2px); }
.mood-auto.off { opacity: .38; }
.mood-auto.spinning { animation: spin 3s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Live2D 回退画布（live2d-init.js 注入，id 契约：l2d-canvas） */
#l2d-canvas { z-index: 1; }

/* ===== 3.3 伴侣面板：聊天卡 + 输入卡 ===== */
.panel {
  display: flex; flex-direction: column; gap: var(--gap);
  min-height: 0;
}
.panel-card { min-height: 0; box-sizing: border-box; }
.card-title {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 18px 10px;
  font-size: 12.5px; font-weight: 600; letter-spacing: 2.5px;
  color: var(--ink-dim); text-transform: uppercase;
}
.card-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--rose); box-shadow: 0 0 8px rgba(255, 128, 165, .8);
}
.chat-card { flex: 1; display: flex; flex-direction: column; }

/* 聊天窗：内部滚动，玻璃气泡流 */
#chat-log {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column; gap: 10px;
  padding: 4px 16px 16px; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .25) transparent;
}
#chat-log::-webkit-scrollbar { width: 5px; }
#chat-log::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .22); border-radius: 99px; }
#chat-log::-webkit-scrollbar-track { background: transparent; }

/* 聊天气泡：圆润有质感（user 玫瑰渐变右浮 / anan 奶油玻璃左浮） */
.msg {
  max-width: 82%; padding: 10px 14px;
  border-radius: 18px; font-size: 14px; line-height: 1.6;
  word-break: break-word; animation: msgIn .3s ease both;
}
.msg.user {
  align-self: flex-end;
  border-bottom-right-radius: 6px;
  background: linear-gradient(135deg, var(--rose), var(--rose-deep));
  color: #fff; box-shadow: 0 6px 18px rgba(255, 109, 147, .32);
}
.msg.anan {
  align-self: flex-start;
  border-bottom-left-radius: 6px;
  background: linear-gradient(135deg, rgba(255, 255, 255, .95), rgba(255, 240, 244, .9));
  color: #7c3f4c;
  box-shadow: 0 6px 18px rgba(20, 8, 12, .28), inset 0 1px 0 rgba(255, 255, 255, .7);
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 输入卡 */
.input-card { padding: 12px; }
#input-bar { display: flex; align-items: flex-end; gap: 10px; }
#chat-input {
  flex: 1; min-width: 0; box-sizing: border-box;
  height: 44px; max-height: 110px; padding: 11px 16px;
  border-radius: 16px; resize: none; outline: none;
  border: 1px solid rgba(255, 255, 255, .22);
  background: rgba(255, 255, 255, .09);
  color: var(--ink); font-size: 14px; line-height: 1.5;
  font-family: inherit;
  transition: border-color .25s ease, background .25s ease, box-shadow .25s ease;
}
#chat-input::placeholder { color: rgba(255, 224, 231, .42); }
#chat-input:focus {
  border-color: rgba(255, 128, 165, .65);
  background: rgba(255, 255, 255, .13);
  box-shadow: 0 0 0 3px rgba(255, 128, 165, .18);
}
.btn {
  border: 1px solid rgba(255, 255, 255, .22);
  background: rgba(255, 255, 255, .1);
  color: var(--ink); cursor: pointer;
  border-radius: 14px; font-family: inherit;
  transition: transform .18s ease, background .25s ease, opacity .25s ease, box-shadow .25s ease;
}
.btn:hover { background: rgba(255, 255, 255, .18); transform: translateY(-1px); }
.btn:active { transform: scale(.96); }
.btn-tts { flex: none; width: 44px; height: 44px; border-radius: 50%; font-size: 17px; }
.btn-tts.off { opacity: .38; }                  /* 朗读关闭态（app.js 切换 .off） */
.btn-send {
  flex: none; height: 44px; padding: 0 20px;
  border: none; border-radius: 16px;
  background: linear-gradient(135deg, var(--rose), var(--rose-deep));
  color: #fff; font-size: 14px; font-weight: 600; letter-spacing: 2px;
  box-shadow: 0 8px 22px rgba(255, 109, 147, .35);
}
.btn-send:hover { box-shadow: 0 10px 26px rgba(255, 109, 147, .5); }
.btn-send:disabled, #chat-input:disabled { opacity: .5; cursor: default; transform: none; }

/* ===== 3.4 底栏：ANAN OS 精简玻璃条 ===== */
.os-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 20px; border-radius: 18px;
  font-size: 12px; letter-spacing: 1.5px; color: var(--ink-dim);
}
.os-brand { display: inline-flex; align-items: center; gap: 8px; }
.os-heart { color: var(--rose); text-shadow: 0 0 8px rgba(255, 128, 165, .7); }
.os-link { opacity: .85; }

/* ---------- 4. 响应式：窄屏/矮屏自适应（仍全屏零滚动） ---------- */
@media (max-width: 880px) {
  body { padding: 10px 10px calc(8px + env(safe-area-inset-bottom)); gap: 12px; }
  .layout { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1.15fr) minmax(0, 1fr); }
  .stage-wrap::before { inset: -14px; }
  .status-pill { gap: 10px; padding: 8px 16px; font-size: 13px; }
  .mood-btn { width: 40px; height: 40px; font-size: 18px; }
  .mood-dock { bottom: 12px; gap: 8px; padding: 7px 10px; }
  .bubble { max-width: 88%; font-size: 13px; top: 7%; }
  .os-bar { padding: 8px 14px; font-size: 10.5px; letter-spacing: 1px; border-radius: 14px; }
  .msg { max-width: 88%; }
  #chat-input { font-size: 13px; padding: 11px 12px; }
}
@media (max-height: 640px) {
  body { gap: 10px; }
  .bubble { top: 6%; }
  .tap-hint { bottom: 66px; }
}

/* ---------- 5. 降级与无障碍 ---------- */
@supports not ((backdrop-filter: blur(4px)) or (-webkit-backdrop-filter: blur(4px))) {
  .glass { background: rgba(40, 24, 28, .82); }   /* 无毛玻璃能力：加深底色保可读 */
}
@media (prefers-reduced-motion: reduce) {
  #anan-figure, .mood-btn.on, .tap-hint, .mood-auto.spinning { animation: none !important; }
}

/* ============================================================
 * 6. v1.3 设置中心（追加段，零改动 v1.2 全部既有规则）
 *    毛玻璃模态 + 深玻璃表单 + 滑块开关 + toast；契约 id 见 index.html
 * ============================================================ */

/* 输入卡里的 ⚙ 按钮（与 btn-tts 同族圆形） */
.btn-settings { flex: none; width: 44px; height: 44px; border-radius: 50%; font-size: 17px; }

/* 隐藏文件选择框（导入用） */
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  clip: rect(0 0 0 0); clip-path: inset(50%);
  overflow: hidden; white-space: nowrap;
}

/* ---------- 6.1 遮罩与模态壳 ---------- */
.settings-mask {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  background: rgba(16, 8, 12, .55);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .28s ease, visibility .28s ease;
}
.settings-mask.show { opacity: 1; visibility: visible; pointer-events: auto; }

.settings-modal {
  width: min(760px, calc(100% - 24px));
  max-height: min(88dvh, 900px);
  display: flex; flex-direction: column;
  border-radius: 26px;
  background: linear-gradient(150deg, rgba(58, 32, 40, .92), rgba(38, 22, 28, .94));
  transform: translateY(14px) scale(.98);
  transition: transform .28s ease;
  overflow: hidden;
}
.settings-mask.show .settings-modal { transform: translateY(0) scale(1); }

.set-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
}
.set-title { display: inline-flex; align-items: center; gap: 9px; font-size: 16px; font-weight: 700; letter-spacing: 2px; }
.set-ver { font-style: normal; font-size: 11px; color: var(--ink-dim); letter-spacing: 1px; border: 1px solid rgba(255, 255, 255, .2); border-radius: 999px; padding: 2px 8px; }
.set-close { width: 34px; height: 34px; border-radius: 50%; font-size: 14px; }

/* ---------- 6.2 滚动主体与分区卡 ---------- */
.set-body {
  overflow-y: auto; min-height: 0;
  padding: 14px 20px 18px;
  display: flex; flex-direction: column; gap: 14px;
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .25) transparent;
}
.set-body::-webkit-scrollbar { width: 6px; }
.set-body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .22); border-radius: 99px; }

.set-card {
  border: 1px solid rgba(255, 255, 255, .13);
  background: rgba(255, 255, 255, .05);
  border-radius: 18px;
  padding: 14px 16px 12px;
  box-sizing: border-box;
}
.set-card-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700; letter-spacing: 1.5px;
  color: var(--ink); margin-bottom: 12px;
}
.set-card-title .switch { margin-left: auto; }

/* ---------- 6.3 表单元素（深玻璃风） ---------- */
.set-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
}
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.span2 { grid-column: span 2; }
.f-label { font-size: 11.5px; color: var(--ink-dim); letter-spacing: .5px; }
.set-grid input[type="text"], .set-grid input[type="password"], .set-grid input[type="number"],
.set-grid select, .set-grid textarea {
  width: 100%; box-sizing: border-box;
  padding: 9px 12px; border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .2);
  background: rgba(20, 10, 14, .45);
  color: var(--ink); font-size: 13px; font-family: inherit; line-height: 1.5;
  outline: none; resize: vertical;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.set-grid select option { background: #2a1a20; color: var(--ink); }
.set-grid textarea { min-height: 108px; }
.set-grid input::placeholder, .set-grid textarea::placeholder { color: rgba(255, 224, 231, .35); }
.set-grid input:focus, .set-grid select:focus, .set-grid textarea:focus {
  border-color: rgba(255, 128, 165, .7);
  background: rgba(20, 10, 14, .6);
  box-shadow: 0 0 0 3px rgba(255, 128, 165, .16);
}
.pair { display: flex; gap: 8px; }
.pair input { min-width: 0; }

/* 隐藏/显示子表单（默认折叠） */
.grp-sub { display: none; }
.grp-sub.show, #grp-reason-custom.show { display: grid; }
#grp-reason-custom { display: none; }
#grp-reason-custom.show { display: flex; }

/* 测试行 */
.test-row { flex-direction: row; align-items: center; gap: 10px; flex-wrap: wrap; }
.test-out { font-size: 12px; line-height: 1.5; color: var(--ink-dim); min-width: 0; }
.test-out.ok { color: #9ff0b8; }
.test-out.bad { color: #ffb3c0; }

/* 分区提示小字 */
.set-note {
  grid-column: span 2;
  margin: 2px 0 0; font-size: 11.5px; line-height: 1.65;
  color: var(--ink-dim);
}
.set-note b { color: var(--rose-soft); font-weight: 600; }

/* ---------- 6.4 滑块开关 ---------- */
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: none; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch .slider {
  position: absolute; inset: 0; border-radius: 999px;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .25);
  transition: background .25s ease, box-shadow .25s ease;
}
.switch .slider::before {
  content: ""; position: absolute; left: 3px; top: 50%;
  width: 17px; height: 17px; margin-top: -8.5px; border-radius: 50%;
  background: rgba(255, 240, 244, .85);
  transition: transform .25s ease, background .25s ease;
}
.switch input:checked + .slider {
  background: linear-gradient(135deg, var(--rose), var(--rose-deep));
  border-color: rgba(255, 255, 255, .4);
  box-shadow: 0 0 12px rgba(255, 109, 147, .5);
}
.switch input:checked + .slider::before { transform: translateX(17px); background: #fff; }

/* ---------- 6.5 预设与操作按钮 ---------- */
.persona-presets { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.persona-preset { padding: 7px 14px; border-radius: 999px; font-size: 12px; }
.preset-hint { font-size: 11px; color: var(--ink-dim); }
.set-btn { padding: 9px 16px; border-radius: 12px; font-size: 12.5px; font-weight: 600; letter-spacing: 1px; }
.set-btn.primary {
  border: none; background: linear-gradient(135deg, var(--rose), var(--rose-deep));
  color: #fff; box-shadow: 0 6px 18px rgba(255, 109, 147, .35);
}
.set-btn.primary:hover { box-shadow: 0 8px 22px rgba(255, 109, 147, .5); }
.set-btn.danger { border-color: rgba(255, 130, 130, .45); color: #ffb3b3; }
.set-btn.danger:hover { background: rgba(255, 90, 90, .16); }
.cfg-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- 6.6 toast（模态内浮动提示） ---------- */
.set-toast {
  position: absolute; left: 50%; top: 14px; z-index: 5;
  transform: translateX(-50%) translateY(-8px);
  padding: 8px 16px; border-radius: 999px;
  background: linear-gradient(135deg, rgba(255, 255, 255, .92), rgba(255, 236, 241, .88));
  color: #7c3f4c; font-size: 12.5px; font-weight: 600;
  box-shadow: 0 8px 24px rgba(20, 8, 12, .4);
  opacity: 0; pointer-events: none; white-space: nowrap; max-width: 92%;
  overflow: hidden; text-overflow: ellipsis;
  transition: opacity .25s ease, transform .25s ease;
}
.set-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.set-toast.err { background: linear-gradient(135deg, rgba(255, 214, 214, .95), rgba(255, 180, 190, .92)); }

/* ---------- 6.7 响应式（窄屏：单列表单 + 全宽模态） ---------- */
@media (max-width: 880px) {
  .settings-modal { width: calc(100% - 12px); max-height: 92dvh; border-radius: 20px; }
  .set-body { padding: 12px 12px 14px; }
  .set-grid { grid-template-columns: 1fr; }
  .field.span2, .set-note { grid-column: span 1; }
  .btn-settings { width: 40px; height: 40px; font-size: 15px; }
  .set-toast { white-space: normal; text-align: center; border-radius: 14px; }
}
@media (max-height: 640px) {
  .settings-modal { max-height: 94dvh; }
  .set-grid textarea { min-height: 84px; }
}

/* ============================================================
 * v1.4 动作视频播放器（#motion-stage 由 motion.js 动态注入 #stage）
 * 层级策略：与 #anan-figure 同 z-index:1、DOM 靠后即覆盖立绘；
 *           pointer-events:none → 点击原生穿透到 #anan-figure，
 *           app.js 的立绘冒泡语录+TTS 逻辑零改动直接生效；
 *           #stage::after 渐暗蒙层（z2）仍盖在视频上，视觉与 v1.3 统一。
 * ============================================================ */
#motion-stage {
  position: absolute; inset: 0; z-index: 1;
  overflow: hidden;
  opacity: 0;                              /* 就绪后 .on 淡入，避免半加载闪现 */
  transition: opacity .3s ease;
  pointer-events: none;                    /* 点击穿透：立绘点击/触摸事件原生可用 */
}
#motion-stage.on { opacity: 1; }
#motion-stage video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;                       /* 方形 640 撑满舞台，脸部置上 30% */
  object-position: center 30%;
  opacity: 0;                              /* 双 video 淡切（motion.js 控制 .show 互补） */
  transition: opacity .3s ease;
  pointer-events: none;
  background: transparent;
}
#motion-stage video.show { opacity: 1; }

/* 无障碍：prefers-reduced-motion 下取消淡切过渡（视频内容本身仍由 JS 控制） */
@media (prefers-reduced-motion: reduce) {
  #motion-stage { transition: none; }
  #motion-stage video { transition: none; }
}

/* 窄屏：脸部再上移一点，防止 cover 裁切压住面部（移动视口防溢出同源） */
@media (max-width: 768px) {
  #motion-stage video { object-position: center 26%; }
}
