/* ── showcase_chat.css ── 相声展示聊天页独立样式 ── */

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
    'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  background: linear-gradient(180deg, #d9e9fb 0%, #bed4ea 58%, #a5bfd9 100%);
  height: 100vh;
  height: 100dvh; /* mobile safe */
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 微信内非 HTTPS 提示条 */
.wechat-warning {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  padding: 10px 14px;
  background: rgba(255, 193, 7, 0.96);
  color: #3b2a00;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
}

body.has-wechat-warning {
  padding-top: 44px;
}

/* ── 顶部栏 ── */
#top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #e0e0e0;
  flex-shrink: 0;
  z-index: 10;
  position: relative;
}
.top-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.avatar-small {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}
.top-bar-title {
  font-size: 16px;
  font-weight: 600;
  color: #212121;
}
.top-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.status-chip {
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 12px;
  background: #e0e0e0;
  color: #616161;
}
.status-chip.active {
  background: #00b894;
  color: #fff;
}

/* 彩排开关 */
.rehearsal-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #616161;
  cursor: pointer;
  user-select: none;
}
.rehearsal-toggle input { width: 14px; height: 14px; }
.rehearsal-label { white-space: nowrap; }

/* ── 3D 模型区域 — 填充顶部栏和底部栏之间 ── */
#model-area {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 60px; /* 底部栏上方 */
  z-index: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
#model-area #glbdom {
  width: min(100vw, 100%);
  height: 100%;
  max-width: 100%;
}
#model-area canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* ── 字幕浮层 — 贴在底部栏上方 ── */
#subtitle-area {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 68px;
  z-index: 5;
  text-align: center;
  padding: 0 16px;
  pointer-events: none;
}
.subtitle-speaker {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  color: rgba(255,255,255,0.8);
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.subtitle-speaker.speaker-llm { color: #8ec5fc; }
.subtitle-speaker.speaker-ceo { color: #7df5d4; }
.subtitle-text {
  display: inline-block;
  max-width: 92%;
  font-size: 20px;
  line-height: 32px;
  color: #fff;
  font-weight: 600;
  padding: 8px 20px;
  background: rgba(0,0,0,0.55);
  border-radius: 8px;
  word-break: break-all;
  animation: subtitleFadeIn 0.3s ease;
}
.subtitle-text:empty {
  display: none;
}
.subtitle-text.fade-out {
  animation: subtitleFadeOut 0.3s ease forwards;
}
@keyframes subtitleFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes subtitleFadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* ── 底部栏 — 固定在屏幕底部 ── */
#bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 6px 16px;
  padding-bottom: max(6px, env(safe-area-inset-bottom));
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(0,0,0,0.08);
  z-index: 20;
}

/* 台词提示（彩排模式） */
.line-hint {
  text-align: center;
  font-size: 13px;
  color: #888;
  padding: 4px 8px;
  margin-bottom: 4px;
  word-break: break-all;
  line-height: 20px;
}
.bottom-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.mic-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: auto;
  padding: 8px 20px;
  border: none;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  background: linear-gradient(135deg, #4A90E2, #6C5CE7);
  color: #fff;
}
.mic-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.mic-btn.listening {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  animation: pulse-ring 1.5s ease infinite;
}
.mic-btn.paused {
  background: linear-gradient(135deg, #f39c12, #e67e22);
}
.mic-btn .layui-icon {
  font-size: 16px;
}

@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 rgba(231,76,60,0.4); }
  70%  { box-shadow: 0 0 0 12px rgba(231,76,60,0); }
  100% { box-shadow: 0 0 0 0 rgba(231,76,60,0); }
}

/* 右下角"下一句"按钮 — 放在底部栏内，开始演出右边 */
.skip-fab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 20px;
  border: none;
  border-radius: 20px;
  background: linear-gradient(135deg, #4A90E2, #6C5CE7);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(74,144,226,0.4);
  transition: opacity 0.2s, transform 0.2s;
}
.skip-fab:active {
  opacity: 0.8;
  transform: scale(0.95);
}

/* 旧的 skip-btn 保留兼容 */
.skip-btn {
  position: absolute;
  top: -44px;
  right: 16px;
  padding: 6px 16px;
  border: none;
  border-radius: 16px;
  background: rgba(0,0,0,0.45);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: opacity 0.2s;
}
.skip-btn:active {
  opacity: 0.7;
}

/* 进度条 */
.progress-bar-wrap {
  margin-top: 8px;
  height: 4px;
  background: #e0e0e0;
  border-radius: 2px;
  position: relative;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4A90E2, #00B894);
  border-radius: 2px;
  width: 0%;
  transition: width 0.3s;
}
.progress-text {
  position: absolute;
  right: 0;
  top: -18px;
  font-size: 11px;
  color: #616161;
}

/* ── 预加载遮罩 ── */
#preload-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.preload-card {
  background: #fff;
  border-radius: 16px;
  padding: 32px 28px;
  text-align: center;
  min-width: 260px;
}
.preload-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: #212121;
}
.preload-bar {
  height: 6px;
  background: #e0e0e0;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}
.preload-fill {
  height: 100%;
  background: linear-gradient(90deg, #4A90E2, #00B894);
  width: 0%;
  transition: width 0.3s;
}
.preload-count {
  font-size: 13px;
  color: #616161;
}

/* ── 剧本选择弹窗 ── */
.picker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.picker-card {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  width: 90%;
  max-width: 360px;
}
.picker-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  text-align: center;
  color: #212121;
}
.script-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
  max-height: 300px;
  overflow-y: auto;
}
.script-item {
  padding: 12px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.script-item.selected {
  border-color: #4A90E2;
  background: rgba(74,144,226,0.08);
}
.script-item-title {
  font-size: 15px;
  font-weight: 600;
  color: #212121;
}
.script-item-desc {
  font-size: 13px;
  color: #616161;
  margin-top: 2px;
}
.picker-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}
.picker-checkbox {
  font-size: 14px;
  color: #616161;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.picker-actions .btn-primary {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
}

/* ── 响应式 ── */

/* 手机竖屏 */
@media (max-width: 480px) {
  .subtitle-text {
    font-size: 18px;
    line-height: 28px;
    max-width: 96%;
  }
}

/* 大屏 / 投屏（宽度 >= 1024px） */
@media (min-width: 1024px) {
  #top-bar {
    padding: 14px 32px;
  }
  .top-bar-title {
    font-size: clamp(18px, 1.6vw, 24px);
  }
  .status-chip {
    font-size: clamp(13px, 1.2vw, 16px);
    padding: 4px 14px;
  }
  .rehearsal-toggle {
    font-size: clamp(13px, 1.2vw, 16px);
    gap: 6px;
  }
  .rehearsal-toggle input {
    width: 18px;
    height: 18px;
  }

  /* 字幕放大 */
  .subtitle-speaker {
    font-size: clamp(15px, 1.4vw, 20px);
  }
  .subtitle-text {
    font-size: clamp(22px, 2.2vw, 36px);
    line-height: 1.6;
    padding: 12px 32px;
    max-width: 80%;
  }
  #subtitle-area {
    bottom: 90px;
  }

  /* 底部栏放大 */
  #bottom-bar {
    padding: 10px 32px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }
  .line-hint {
    font-size: clamp(14px, 1.3vw, 18px);
    padding: 6px 12px;
  }
  .mic-btn {
    padding: 12px 32px;
    font-size: clamp(15px, 1.4vw, 20px);
    border-radius: 28px;
  }
  .mic-btn .layui-icon {
    font-size: clamp(18px, 1.6vw, 24px);
  }
  .skip-fab {
    padding: 12px 32px;
    font-size: clamp(15px, 1.4vw, 20px);
    border-radius: 28px;
  }
  .bottom-controls {
    gap: 20px;
  }

  /* 进度条 */
  .progress-bar-wrap {
    height: 6px;
    margin-top: 12px;
  }
  .progress-text {
    font-size: clamp(12px, 1.1vw, 15px);
    top: -22px;
  }

  /* 模型区域给底部更多空间 */
  #model-area {
    bottom: 80px;
  }
}

/* 超大屏 / 4K 投屏（宽度 >= 1920px） */
@media (min-width: 1920px) {
  .subtitle-text {
    font-size: clamp(32px, 2.4vw, 48px);
    padding: 16px 48px;
    border-radius: 12px;
    max-width: 70%;
  }
  .subtitle-speaker {
    font-size: clamp(18px, 1.4vw, 24px);
    margin-bottom: 8px;
  }
  #subtitle-area {
    bottom: 110px;
  }
  .mic-btn {
    padding: 16px 48px;
    font-size: clamp(18px, 1.4vw, 24px);
    border-radius: 32px;
  }
  .skip-fab {
    padding: 16px 48px;
    font-size: clamp(18px, 1.4vw, 24px);
    border-radius: 32px;
  }
  #bottom-bar {
    padding: 14px 48px;
  }
  #model-area {
    bottom: 100px;
  }
}

