/* 直播间（虚拟主播分身）页面样式 */
/* 直播间全屏：去掉 header 后占满整个视口 */
body:has(.live3d) { overflow: hidden; }
.live3d {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100svh;
  background: radial-gradient(120% 120% at 50% 0%, #0b1220 0%, #05080f 60%, #05080f 100%);
  overflow: hidden;
  z-index: 1;
}

/* 纸/墨主题适配（直播间全屏背景） */
body.paper .live3d { background: radial-gradient(120% 120% at 50% 0%, #f2ede2 0%, #e6e0d2 60%, #ddd6c6 100%); }

.live3d-stage {
  position: absolute;
  inset: 0;
  cursor: grab;
}
.live3d-stage:active { cursor: grabbing; }
.live3d-stage canvas { width: 100%; height: 100%; display: block; }

.live3d-loading {
  position: absolute;
  inset: 0;
  margin: auto;
  height: fit-content;
  text-align: center;
  color: rgba(226, 222, 210, 0.7);
  font: 500 16px/1.6 "Noto Sans SC", sans-serif;
  pointer-events: none;
}
.live3d-stage.is-on .live3d-loading,
.live3d-stage.is-failed .live3d-loading { opacity: 0; }

.live-cam-status {
  position: absolute;
  left: 16px;
  top: 16px;
  margin: 0;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(10, 16, 26, 0.55);
  border: 1px solid rgba(94, 234, 212, 0.3);
  color: rgba(226, 222, 210, 0.9);
  font: 500 13px/1.4 "Noto Sans SC", sans-serif;
  backdrop-filter: blur(6px);
  pointer-events: none;
}

/* 控制条：默认收拢于左下角，可折叠展开 */
.live-controls {
  position: absolute;
  left: 16px;
  bottom: 16px;
  width: min(380px, calc(100% - 32px));
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  z-index: 20;
}
.live-controls.collapsed .live-scripts,
.live-controls.collapsed .live-actions { display: none; }
.live-fab {
  width: 46px;
  height: 46px;
  padding: 0;
  border-radius: 12px;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.live-scripts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
}
.live-script-btn {
  border: 1px solid rgba(94, 234, 212, 0.35);
  background: rgba(10, 16, 26, 0.5);
  color: rgba(226, 222, 210, 0.92);
  border-radius: 999px;
  padding: 8px 16px;
  font: 600 14px/1 "Noto Sans SC", sans-serif;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.live-script-btn:hover { transform: translateY(-1px); }
.live-script-btn.active {
  background: rgba(94, 234, 212, 0.18);
  border-color: #5eead4;
  color: #eafff9;
}
.live-actions { display: flex; gap: 10px; justify-content: flex-start; flex-wrap: wrap; }
.btn-live {
  border: 1px solid rgba(242, 237, 226, 0.25);
  background: rgba(10, 16, 26, 0.6);
  color: rgba(242, 237, 226, 0.95);
  border-radius: 10px;
  padding: 10px 18px;
  font: 600 15px/1 "Noto Sans SC", sans-serif;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background 0.2s ease, transform 0.15s ease;
}
.btn-live:hover { transform: translateY(-1px); background: rgba(20, 30, 46, 0.8); }
.btn-live.on { border-color: #ff4d6d; color: #ffd9e1; }

/* 显示墙字号 A− / A+ 调节按钮：紧凑图标样式 */
.live-font-btn {
  min-width: 44px;
  padding: 10px 12px;
  font: 700 17px/1 "Noto Sans SC", sans-serif;
  letter-spacing: 0.5px;
}
.live-font-btn:hover { border-color: #5eead4; color: #5eead4; }

/* 卡拉 OK 字幕与原文面板已取消（文本滚动改由显示墙提词器承担） */

@media (max-width: 640px) {
  .live-controls { bottom: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .btn-live, .live-script-btn { transition: none; }
}

/* 降级 */
.live-fallback { display: none; padding: 80px 24px; max-width: 720px; margin: 0 auto; color: var(--ink, #1a1a1a); }
.live3d-stage.is-failed ~ .live-fallback { display: block; }
.live-fallback .fallback-script { margin-bottom: 24px; }
.live-fallback h3 { margin: 0 0 8px; }

@media (max-width: 640px) {
  .live-transcript { bottom: 150px; font-size: 17px; }
  .live-controls { bottom: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .btn-live, .live-script-btn { transition: none; }
}

/* 自定义文本弹窗 */
.live-settext-modal {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(4, 8, 16, 0.62);
  backdrop-filter: blur(4px);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.live-settext-modal.show { opacity: 1; pointer-events: auto; }
.live-settext-box {
  width: min(640px, calc(100% - 36px));
  max-height: 86svh;
  overflow: auto;
  padding: 22px 24px 20px;
  border-radius: 18px;
  background: rgba(12, 18, 30, 0.96);
  border: 1px solid rgba(94, 234, 212, 0.35);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  transform: translateY(8px) scale(0.98);
  transition: transform 0.22s ease;
}
.live-settext-modal.show .live-settext-box { transform: translateY(0) scale(1); }
.live-settext-box h3 {
  margin: 0 0 8px;
  font: 700 20px/1.2 "Noto Serif SC", serif;
  color: #eafff9;
}
.live-settext-hint {
  margin: 0 0 14px;
  font: 400 13px/1.6 "Noto Sans SC", sans-serif;
  color: rgba(226, 222, 210, 0.66);
}
.live-settext-box textarea {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  min-height: 180px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(242, 237, 226, 0.22);
  background: rgba(8, 12, 20, 0.9);
  color: rgba(242, 237, 226, 0.96);
  font: 400 15px/1.7 "Noto Serif SC", "Songti SC", serif;
  outline: none;
}
.live-settext-box textarea:focus { border-color: #5eead4; }
.live-settext-box input.live-settext-title {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 12px;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid rgba(242, 237, 226, 0.22);
  background: rgba(8, 12, 20, 0.9);
  color: rgba(242, 237, 226, 0.96);
  font: 400 15px/1.4 "Noto Sans SC", sans-serif;
  outline: none;
}
.live-settext-box input.live-settext-title:focus { border-color: #5eead4; }
.live-settext-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 14px;
}
.btn-live-primary {
  border-color: #5eead4;
  color: #06202a;
  background: #5eead4;
}
.btn-live-primary:hover { background: #7df3df; }

/* Azure 语音配置弹窗（复用弹窗外壳，补充表单样式） */
.live-speech-box .sp-field {
  display: block;
  margin: 0 0 12px;
  font: 400 13px/1.5 "Noto Sans SC", sans-serif;
  color: rgba(226, 222, 210, 0.82);
}
.live-speech-box .sp-field input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(242, 237, 226, 0.22);
  background: rgba(8, 12, 20, 0.9);
  color: rgba(242, 237, 226, 0.96);
  font: 400 14px/1.4 "Noto Sans SC", sans-serif;
  outline: none;
}
.live-speech-box .sp-field input:focus { border-color: #5eead4; }
.live-speech-box .sp-note {
  margin: 0 0 12px;
  font: 400 12px/1.6 "Noto Sans SC", sans-serif;
  color: rgba(255, 196, 140, 0.85);
}
.live-speech-box .sp-endpoint {
  margin: -4px 0 12px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(94, 234, 212, 0.08);
  border: 1px solid rgba(94, 234, 212, 0.22);
  font: 400 12px/1.5 "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  color: #5eead4;
  word-break: break-all;
}
.live-speech-box .sp-status {
  margin: 10px 0 0;
  min-height: 18px;
  font: 400 13px/1.5 "Noto Sans SC", sans-serif;
  color: #5eead4;
}

/* ============================================================
   竖版（微信视频号风格 9:16）直播间
   - stage 被约束为「宽 = 高 × 9/16、不超过视口宽」的居中竖屏框；
     桌面端两侧留出暗色 pillarbox（像手机预览卡片），移动端铺满全屏。
   - JS 依据 .live3d.portrait 切换近景机位（见 home-live.js）。
   ============================================================ */
.live3d.portrait {
  background: radial-gradient(120% 120% at 50% 0%, #0a0f1a 0%, #04070d 60%, #04070d 100%);
  display: flex;
  justify-content: center;
}
.live3d.portrait .live3d-stage {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100svh * 9 / 16, 100%);
  height: 100svh;
  cursor: grab;
}
/* 竖屏框两侧留出柔和暗边，强化「手机预览」质感 */
.live3d.portrait::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(0,0,0,0.35) 0%, transparent 22%, transparent 78%, rgba(0,0,0,0.35) 100%);
  pointer-events: none;
  z-index: 2;
}

/* 控制条：在竖屏框内居中贴底，宽度跟随竖屏框（避免溢出到 pillarbox） */
.live3d.portrait .live-controls {
  left: 50%;
  transform: translateX(-50%);
  width: min(100svh * 9 / 16, calc(100% - 24px));
  bottom: 14px;
}
/* 竖屏下按钮较多，允许纵向换行并收紧间距 */
.live3d.portrait .live-actions { gap: 8px; }
.live3d.portrait .btn-live { padding: 9px 14px; font-size: 14px; }

/* 锚点样式的切换按钮（📱竖版 / 🖥横版）：复用 .btn-live 外观但去除链接默认样式 */
a.btn-live {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-sizing: border-box;
}
a.btn-live:hover { color: #5eead4; }

