.voice-toolbar { position:absolute; top:12px; left:12px; z-index:25; display:flex; gap:6px; flex-wrap:wrap; }
.voice-toolbar button,.voice-editor button { border:1px solid #39715a; background:#10241fee; color:#b8f5d5; border-radius:5px; padding:7px 10px; cursor:pointer; font:inherit; font-size:12px; }
.voice-toolbar button:hover,.voice-editor button:hover { background:#214536; border-color:#91eab5; }
/* =========================================================================
   ADV 视觉小说对话履历 (ADV Backlog Screen Overlay · 覆盖监视器大半透明)
   ========================================================================= */
.voice-history-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  white-space: nowrap;
}
.voice-history-toggle[hidden] {
  display: none !important;
}

/* 覆盖整个监视器的大半透明 ADV Backlog 视窗 */
.voice-history-panel {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 50;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
  background: rgba(3, 10, 7, 0.82);
  backdrop-filter: blur(20px) saturate(125%);
  -webkit-backdrop-filter: blur(20px) saturate(125%);
  box-shadow: inset 0 0 100px rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(52, 211, 153, 0.2);
  color: #d1fae5;
  pointer-events: auto;
  user-select: text;
  cursor: var(--scope-cursor) !important;
  animation: adv-backlog-enter 220ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.voice-history-panel.is-closing {
  animation: adv-backlog-leave 180ms cubic-bezier(0.3, 0, 0.8, 0.15) forwards;
  pointer-events: none;
}
.voice-history-panel * {
  cursor: var(--scope-cursor) !important;
}
.voice-history-panel[hidden] {
  display: none !important;
}

/* 打开历史记录时，彻底淡出隐藏监视器的取景框与 HUD，防止遮挡与冲突 */
.has-history-open .cctv-hud-top,
.has-history-open .cctv-hud-bottom,
.has-history-open .cctv-bracket,
.stage-container:has(.voice-history-panel:not([hidden])) .cctv-hud-top,
.stage-container:has(.voice-history-panel:not([hidden])) .cctv-hud-bottom,
.stage-container:has(.voice-history-panel:not([hidden])) .cctv-bracket {
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity 0.2s ease;
}

@keyframes adv-backlog-enter {
  0% {
    opacity: 0;
    transform: scale(0.995);
    filter: brightness(1.2) blur(4px);
  }
  100% {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

@keyframes adv-backlog-leave {
  0% {
    opacity: 1;
    transform: none;
    filter: none;
  }
  100% {
    opacity: 0;
    transform: scale(0.995);
    filter: brightness(1.1) blur(3px);
  }
}

/* ADV 履历顶部导航栏 */
.voice-history-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  padding: 12px 32px;
  background: rgba(3, 16, 11, 0.6);
  border-bottom: 1px solid rgba(52, 211, 153, 0.2);
  color: rgba(167, 243, 208, 0.9);
  font-family: var(--font-mono, monospace);
  letter-spacing: 1px;
}
.voice-history-heading-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.voice-history-adv-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 2px;
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(52, 211, 153, 0.4);
  color: var(--emerald-bright);
  letter-spacing: 1.5px;
}
.voice-history-title {
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: 1.2px;
}
.voice-history-heading-right {
  display: flex;
  align-items: center;
  gap: 14px;
}
.voice-history-key-hint {
  font-size: 10px;
  color: rgba(167, 243, 208, 0.45);
  letter-spacing: 0.8px;
}
.voice-history-close-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border: 1px solid rgba(52, 211, 153, 0.35);
  border-radius: 3px;
  background: rgba(5, 24, 17, 0.8);
  color: var(--emerald-bright);
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}
.voice-history-close-btn:hover {
  background: rgba(16, 185, 129, 0.28);
  border-color: var(--emerald-bright);
  color: #ffffff;
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.35);
}

/* 对话历史可滚动流容器 (大幅增大左右留白，居中黄金阅读栏) */
.voice-history-list {
  flex: 1;
  min-height: 0;
  overflow-anchor: none;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 0 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 680px;
  width: 82%;
  margin: 0 auto;
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: rgba(52, 211, 153, 0.35) transparent;
}
.voice-history-list::-webkit-scrollbar {
  width: 6px;
}
.voice-history-list::-webkit-scrollbar-thumb {
  background: rgba(52, 211, 153, 0.35);
  border-radius: 3px;
}
.voice-history-list::-webkit-scrollbar-thumb:hover {
  background: var(--emerald-bright);
}

/* ADV 纯净流式台词行 (左右柔和渐变淡出羽化，无生硬边界) */
.voice-history-item {
  position: relative;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  margin: 0;
  padding: 10px 24px;
  box-sizing: border-box;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: inherit;
  text-align: left;
  cursor: var(--scope-cursor) !important;
  transition: background 0.2s ease, text-shadow 0.2s ease;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, black 6%, black 94%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0%, black 6%, black 94%, transparent 100%);
}
.voice-history-item:hover,
.voice-history-item:focus-visible {
  background: rgba(16, 185, 129, 0.05);
  outline: none;
}
.voice-history-item:hover .voice-history-zh {
  color: #ffffff;
  text-shadow: 0 0 10px rgba(52, 211, 153, 0.45);
}
.voice-history-item:hover .voice-history-ja {
  color: rgba(167, 243, 208, 0.85);
}

.voice-history-zh {
  position: relative;
  z-index: 1;
  display: inline-block;
  width: fit-content;
  max-width: 100%;
  color: rgba(236, 253, 245, 0.82);
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.65;
  letter-spacing: 0.6px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  pointer-events: none;
  transition: color 0.15s ease, text-shadow 0.15s ease;
}
.voice-history-ja {
  position: relative;
  z-index: 1;
  display: inline-block;
  width: fit-content;
  max-width: 100%;
  color: rgba(134, 239, 172, 0.50);
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 12.5px;
  line-height: 1.5;
  letter-spacing: 0.4px;
  pointer-events: none;
  transition: color 0.15s ease;
}
.voice-history-divider {
  flex-shrink: 0;
  height: 1px;
  margin: 6px 24px;
  background: linear-gradient(90deg, transparent, rgba(52, 211, 153, 0.15), transparent);
}

/* =========================================================================
   ADV 方案 1: 卡拉OK文字声波流光染色 (Karaoke Text Wave Sweep)
   彻底杜绝横线打架：文字自身即为声波进度条，随千景原声音频流光扫亮
   ========================================================================= */
.voice-history-item.is-playing,
.voice-history-item.is-tailing {
  background: rgba(16, 185, 129, calc(0.08 * var(--replay-opacity, 1)));
}
.voice-history-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  user-select: none;
  opacity: 0;
  color: transparent;
  -webkit-text-fill-color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
  text-shadow: none;
}
.voice-history-item:is(.is-playing, .is-tailing) .voice-history-glow {
  opacity: var(--replay-opacity, 1);
}
.voice-history-zh .voice-history-glow {
  background-image: linear-gradient(
    90deg,
    #ffffff 0%,
    var(--emerald-bright) calc(var(--replay-progress, 0%) - 1.5%),
    #ffffff var(--replay-progress, 0%),
    transparent calc(var(--replay-progress, 0%) + 0.1%),
    transparent 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 10px rgba(52, 211, 153, 0.65)) drop-shadow(0 0 20px rgba(16, 185, 129, 0.35));
}
.voice-history-ja .voice-history-glow {
  background-image: linear-gradient(
    90deg,
    #a7f3d0 0%,
    var(--emerald-bright) calc(var(--replay-progress, 0%) - 1.5%),
    #ffffff var(--replay-progress, 0%),
    transparent calc(var(--replay-progress, 0%) + 0.1%),
    transparent 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 8px rgba(52, 211, 153, 0.45));
}



.voice-history-item.is-entering,
.voice-history-divider.is-entering {
  animation: voice-history-enter 280ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes voice-history-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.voice-previous-caption { position:absolute; left:50%; bottom:110px; z-index:2; width:min(86%,520px); box-sizing:border-box; padding:5px 14px 6px; transform:translateX(-50%); transform-origin:center bottom; border:1px solid rgba(74,222,128,.14); border-radius:7px; background:rgba(3,14,10,.34); color:rgba(220,252,231,.56); text-align:center; pointer-events:none; opacity:.74; transition:bottom 360ms cubic-bezier(.22,.61,.36,1); }
.voice-previous-caption[hidden] { display:none; }
.voice-previous-caption span { display:block; overflow-wrap:anywhere; }
.voice-previous-caption [lang="zh-CN"] { font-size:11px; line-height:1.35; }
.voice-previous-caption [lang="ja"] { margin-top:2px; color:rgba(134,239,172,.48); font-size:9px; line-height:1.3; }

@keyframes voice-history-pulse { from { opacity:.18; } to { opacity:.4; } }
.voice-caption {
  position: absolute;
  bottom: 46px;
  left: 50%;
  transform: translateX(-50%);
  transform-origin: center bottom;
  z-index: 2; /* 位于画面画布之上，但在显像管滤镜、光栅与暗角之下 */
  width: 112px;
  min-width: 0;
  max-width: min(86%, 520px);
  box-sizing: border-box;
  padding: 8px 18px 10px;
  background: rgba(3, 14, 10, 0.46);
  color: rgba(220, 252, 231, 0.92);
  border: 1px solid rgba(74, 222, 128, 0.16);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(167, 243, 208, 0.08), 0 0 16px rgba(16, 185, 129, 0.04);
  backdrop-filter: blur(8px) saturate(115%);
  -webkit-backdrop-filter: blur(8px) saturate(115%);
  text-align: center;
  opacity: 0;
  overflow: hidden;
  transition: opacity var(--voice-fade-duration, 180ms) ease, width 180ms cubic-bezier(.2,.6,.35,1);
  pointer-events: none;
}
.voice-caption[hidden] { display: none; }
.voice-caption.visible { opacity: 1; }
.stage-container:has(.voice-caption:not([hidden])) .chikage-debug { visibility: hidden; }
.voice-caption-name {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-family: var(--font-mono, monospace);
  font-size: 9.5px;
  letter-spacing: 1px;
  color: rgba(110, 231, 183, 0.68);
  margin-bottom: 5px;
  text-transform: uppercase;
  white-space: nowrap;
}
.voice-caption-name::before,
.voice-caption-name::after {
  content: "";
  display: inline-block;
  width: 4px;
  flex-shrink: 0;
  height: 1px;
  background: rgba(52, 211, 153, 0.22);
}
.voice-caption-name span {
  font-size: 8px;
  opacity: 0.55;
  letter-spacing: 1px;
  margin-left: 2px;
}
.voice-line {
  display: grid;
  font-size: var(--voice-caption-zh-size, clamp(13px, 1.25vw, 15px));
  font-family: system-ui, -apple-system, sans-serif;
  line-height: 23px;
  color: rgba(220, 252, 231, 0.92);
  letter-spacing: 0.6px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
  height: 23px;
  white-space: nowrap;
}
.voice-reserve, .voice-text { grid-area: 1 / 1; min-width: 0; }
.voice-reserve { position: absolute; visibility: hidden; pointer-events: none; }
.voice-japanese {
  font-size: var(--voice-caption-ja-size, clamp(11px, 1.0vw, 12.5px));
  font-family: system-ui, -apple-system, sans-serif;
  color: rgba(134, 239, 172, 0.65);
  line-height: 19px;
  margin-top: 2px;
  letter-spacing: 0.4px;
  height: 19px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}

.voice-editor { width:min(850px,94vw); max-height:90vh; overflow:auto; padding:24px; background:#0d1b17; color:#d4e8dd; border:1px solid #49775e; border-radius:12px; font:14px/1.5 system-ui,sans-serif; box-shadow:0 24px 90px #000b; }
.voice-editor::backdrop { background:#0009; }
.voice-editor-heading { display:flex; justify-content:space-between; align-items:center; gap:12px; }
.voice-editor h2 { margin:0; font-size:20px; }
.voice-editor h3 { font-size:14px; color:#a5eac0; }
.voice-editor p { font-size:12px; color:#9bb8a8; }
.voice-editor-grid { display:grid; grid-template-columns:1.2fr 1fr; gap:28px; }
.voice-editor label { display:flex; flex-direction:column; gap:5px; margin-bottom:12px; font-size:12px; }
.voice-editor input:not([type=checkbox]),.voice-editor textarea,.voice-editor select { width:100%; min-width:0; box-sizing:border-box; border:1px solid #355845; background:#06110d; color:#d4f4df; padding:8px; border-radius:4px; font:13px/1.5 system-ui,sans-serif; }
.voice-editor input[type=checkbox] { accent-color:#6fe2a4; }
.voice-editor .voice-inline { flex-direction:row; align-items:center; gap:8px; }
.voice-editor fieldset { border:1px solid #355845; margin:0 0 12px; padding:12px; }
.voice-numbers { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; }
.voice-actions { display:flex; flex-wrap:wrap; gap:8px; }
.voice-editor [data-status] { color:#a5eac0; min-height:20px; }
.voice-editor ol { font-size:12px; padding-left:20px; overflow-wrap:anywhere; }
@media(max-width:600px) {
  .voice-editor-grid { grid-template-columns:1fr; }
  .voice-editor { padding:16px; }
  .voice-caption { bottom:36px; max-width:92%; padding:6px 12px 8px; }
  .voice-toolbar { top:6px; left:6px; }
  .voice-toolbar button { padding:5px 7px; font-size:10px; }
}
@media(prefers-reduced-motion:reduce) {
  .voice-previous-caption { transition:none; }
  .voice-caption { transition:none; transform:translateX(-50%); }
  .voice-history-item, .voice-history-glow { transition: none; }
  .voice-history-item.is-entering, .voice-history-divider.is-entering { animation: none; }
  .voice-history-item.is-tailing .voice-history-glow { opacity: 0; }
}
