/* =========================================================================
   Stage Module Styles (主要模块 / 视频与交互视窗)
   ========================================================================= */

.chikage-debug {
  position: absolute;
  left: 18px;
  bottom: 54px;
  z-index: 20;
  width: min(260px, calc(100% - 36px));
  max-height: calc(100% - 110px);
  overflow: auto;
  color: var(--emerald-pale);
  background: rgba(4, 14, 12, 0.94);
  border: 1px solid var(--border-dim);
  border-radius: 6px;
  font-size: 11px;
}
.chikage-debug summary { padding: 9px 12px; cursor: var(--scope-cursor); }
.chikage-debug summary span { margin-left: 8px; opacity: .55; font-size: 10px; }
.chikage-debug-body { display: grid; gap: 9px; padding: 2px 12px 12px; }
.chikage-debug-body label { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.chikage-debug-poses { display: flex; gap: 6px; }
.chikage-debug-expressions { display: grid; gap: 8px; margin: 0; padding: 8px; border: 1px solid #315246; border-radius: 4px; min-width: 0; }
.chikage-debug-expressions legend { padding: 0 5px; color: var(--emerald-bright); }
.chikage-debug button, .chikage-debug select {
  color: inherit; background: #0b201a; border: 1px solid #315246;
  border-radius: 4px; font: inherit; padding: 5px 7px; cursor: var(--scope-cursor);
}
.chikage-debug button { flex: 1; }
.chikage-debug button[aria-pressed="true"] { border-color: var(--emerald-bright); background: #194737; }
.chikage-debug input { accent-color: var(--emerald-bright); }
.chikage-debug input[type="range"] { width: 100%; margin: 0; }
.chikage-debug-body .chikage-debug-follow { justify-content: flex-start; }
.chikage-debug p { margin: 0; line-height: 1.6; opacity: .65; }
.chikage-debug :focus-visible { outline: 2px solid var(--emerald-bright); outline-offset: 2px; }

.stage-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 100%;
  background: #020704;
}

/* 拖拽高亮互动状态 */
.stage-container.is-drag-over {
  outline: 2px dashed var(--emerald-bright);
  outline-offset: -6px;
  background: rgba(16, 185, 129, 0.08) !important;
}

.stage-container.is-drag-over * {
  pointer-events: none;
}

/* 占位提示与雷达扫描动效 (兼具点击上传热区) */
.placeholder-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 24px;
  text-align: center;
  cursor: var(--scope-cursor);
  transition: background 0.25s ease;
}

.placeholder-body:hover {
  background: rgba(52, 211, 153, 0.03);
}

.placeholder-watermark {
  font-size: 14px;
  letter-spacing: 2.5px;
  color: var(--emerald-bright);
  margin-bottom: 8px;
  text-shadow: 0 0 12px var(--emerald-glow);
  font-weight: 600;
}

.placeholder-sub {
  font-size: 11px;
  color: rgba(110, 231, 183, 0.6);
  letter-spacing: 1px;
  max-width: 520px;
  line-height: 1.6;
}

.placeholder-upload-pill {
  margin-top: 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.4);
  border-radius: 20px;
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--emerald-pale);
  transition: all 0.25s ease;
  box-shadow: 0 0 14px rgba(52, 211, 153, 0.1);
}

.placeholder-body:hover .placeholder-upload-pill {
  background: rgba(16, 185, 129, 0.25);
  border-color: var(--emerald-bright);
  box-shadow: 0 0 18px var(--emerald-glow);
  transform: translateY(-1px);
}


/* =========================================================================
   真正的监控/摄像机屏幕 (CCTV Surveillance Monitor · 纯正通透冷翠绿)
   ========================================================================= */
.cctv-screen {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #040906;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  contain: strict;
  cursor: var(--scope-cursor);
}

/* Reading shares the same screen and filter stack as the character scene. */
.monitor-reader {
  position:absolute; inset:52px 30px 44px; z-index:2; overflow:auto;
  padding:12px 20px 32px; color:var(--emerald-pale); background:#040906;
  font:14px/1.85 var(--font-mono); overflow-wrap:anywhere;
  scrollbar-color:#276c51 #040906; scrollbar-width:thin;
  filter:url(#p31-oscilloscope-phosphor);
}
.monitor-reader[hidden] { display:none; }
.monitor-reader, .monitor-reader * { user-select:text; }
.monitor-reader h1 { font-size:23px; margin:18px 0 24px; line-height:1.4; }
.monitor-reader h2, .monitor-reader h3, .monitor-reader h4 { line-height:1.5; margin:18px 0 10px; }
.monitor-reader img { display:block; max-width:100%; height:auto; margin:16px auto; }
.monitor-reader a { color:#b4f7d2; text-decoration:underline; }
.monitor-reader button { background:transparent; border:1px solid #34755a; color:var(--emerald-pale); padding:6px 12px; font:inherit; cursor:pointer; text-align:left; }
.monitor-reader button:hover { background:#143628; }
.monitor-reader-nav { display:flex; gap:10px; flex-wrap:wrap; }
.monitor-reader :focus-visible { outline:1px solid var(--emerald-bright); outline-offset:3px; }
.is-reading .scope-glitch-canvas { visibility:hidden; }
.cctv-screen.crt-mode-switching .scope-glitch-canvas { visibility:visible !important; }
.is-reading .chikage-debug, .is-reading .voice-toolbar { display:none; }

/* CRT 显像管分辨率与模式切换失步过渡 (CRT Mode Resync Glitch) */
@keyframes crt-mode-resync-jitter {
  0% {
    filter: brightness(1) contrast(1);
    transform: none;
  }
  15% {
    filter: brightness(1.5) contrast(1.3);
    transform: scale(1.008, 0.992) skewX(0.6deg);
  }
  30% {
    filter: brightness(0.75) contrast(1.35);
    transform: scale(0.995, 1.005) translateY(-2px);
  }
  50% {
    filter: brightness(1.35) contrast(1.15);
    transform: scale(1.004, 0.996) skewX(-0.5deg);
  }
  70% {
    filter: brightness(0.9);
    transform: translateY(1px);
  }
  85% {
    filter: brightness(1.1);
    transform: scale(1, 1);
  }
  100% {
    filter: none;
    transform: none;
  }
}

.cctv-screen.crt-mode-switching {
  animation: crt-mode-resync-jitter 450ms cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@media (prefers-reduced-motion: reduce) {
  .cctv-screen.crt-mode-switching {
    animation: none !important;
  }
}

@media(max-width:600px) { .monitor-reader { inset:48px 18px 40px; padding:10px 10px 24px; font-size:13px; } }

/* 监控主合成画布 (纯净无动态 CSS 滤镜，高斯软焦直接在底图生成时一次性固化) */
.scope-glitch-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  filter: none;
  z-index: 1;
}

/* 通透冷翠微绿滤镜层 (稍微加深一点绿，通透有质感，眼睛舒适，采用标准无损透明度合成) */
.scope-sheer-green-veil {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  background: radial-gradient(
    circle at 50% 50%,
    rgba(16, 185, 129, 0.12) 0%,
    rgba(5, 150, 105, 0.20) 100%
  );
}

/* 监控水平光栅横条纹层 (清晰显像管横条效果，透光易读) */
.scope-scanlines-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.32) 0px,
    rgba(0, 0, 0, 0.32) 1px,
    transparent 1px,
    transparent 3px
  );
  opacity: 0.9;
}

/* 监视器屏幕边缘透镜暗角 */
.scope-vignette-glass {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 7;
  background: radial-gradient(
    circle at 50% 50%,
    transparent 55%,
    rgba(2, 10, 6, 0.28) 85%,
    rgba(0, 6, 3, 0.72) 100%
  );
  box-shadow: inset 0 0 32px rgba(0, 0, 0, 0.65);
}

/* =========================================================================
   摄像机 / 监控画面 UI (CCTV Viewfinder HUD)
   ========================================================================= */
/* 四角取景器折角括号 */
.cctv-bracket {
  position: absolute;
  width: 20px;
  height: 20px;
  pointer-events: none;
  z-index: 10;
  border: 2px solid rgba(52, 211, 153, 0.65);
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.25);
}

.bracket-tl {
  top: 14px;
  left: 14px;
  border-right: none;
  border-bottom: none;
}

.bracket-tr {
  top: 14px;
  right: 14px;
  border-left: none;
  border-bottom: none;
}

.bracket-bl {
  bottom: 14px;
  left: 14px;
  border-right: none;
  border-top: none;
}

.bracket-br {
  bottom: 14px;
  right: 14px;
  border-left: none;
  border-top: none;
}

/* 顶部监控 HUD 信息 */
.cctv-hud-top {
  position: absolute;
  top: 16px;
  left: 42px;
  right: 42px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  z-index: 10;
  font-family: var(--font-mono);
}

.cctv-hud-rec {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(4, 10, 6, 0.72);
  padding: 3px 10px;
  border-radius: 3px;
  border: 1px solid rgba(52, 211, 153, 0.25);
}

.cctv-rec-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 5px rgba(239, 68, 68, 0.5);
  animation: none;
}

.cctv-rec-text {
  font-size: 11px;
  font-weight: 700;
  color: #f87171;
  letter-spacing: 1.5px;
}

.cctv-cam-tag {
  font-size: 9px;
  color: var(--emerald-bright);
  letter-spacing: 1px;
  padding-left: 6px;
  border-left: 1px solid rgba(52, 211, 153, 0.3);
}

.cctv-hud-time {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--emerald-bright);
  background: rgba(4, 10, 6, 0.72);
  padding: 3px 10px;
  border-radius: 3px;
  border: 1px solid rgba(52, 211, 153, 0.25);
  text-shadow: 0 0 6px var(--emerald-glow);
}

/* 底部监控 HUD 信息 */
.cctv-hud-bottom {
  position: absolute;
  bottom: 16px;
  left: 42px;
  right: 42px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  z-index: 10;
  font-family: var(--font-mono);
  font-size: 9px;
  color: rgba(110, 231, 183, 0.75);
  letter-spacing: 0.8px;
  gap: 8px;
}

.cctv-bottom-left, .cctv-bottom-right {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(4, 10, 6, 0.72);
  padding: 3px 8px;
  border-radius: 3px;
  border: 1px solid rgba(52, 211, 153, 0.2);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

@media (max-width: 680px) {
  .cctv-hud-bottom {
    left: 18px;
    right: 18px;
    bottom: 8px;
    font-size: 8px;
  }
  .cctv-bottom-left, .cctv-bottom-right {
    gap: 6px;
    padding: 2px 6px;
  }
}

.cctv-auto-tag {
  color: var(--emerald-pale);
  background: rgba(16, 185, 129, 0.2);
  padding: 1px 4px;
  border-radius: 2px;
}

.hud-val {
  font-weight: bold;
}

.hud-val.highlight {
  color: var(--emerald-pale);
}

/* =========================================================================
   预留：视频播放层扩展容器 (后续接入视频时开箱即用)
   ========================================================================= */
.stage-video-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #000;
  display: none;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  z-index: 2;
}

.stage-video-container.active {
  display: flex;
}

.stage-video-container video,
.stage-video-container iframe {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: none;
}

/* 视频悬浮微控制层（预留） */
.stage-video-hud {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  z-index: 10;
  background: rgba(7, 13, 10, 0.85);
  border: 1px solid var(--border-dim);
  border-radius: 4px;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.25s ease;
  pointer-events: none;
}

.stage-video-container:hover .stage-video-hud {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
