/**
 * ═══════════════════════════════════════════════════════════
 *  监察总署约谈场景样式 (Interrogation Scene Styles)
 *  v3.0.0
 *
 *  设计要点:
 *  1. 全屏纯黑背景, 仅保留对话/独白/选择内容
 *  2. 统一公文仿宋字体 ('GovFangSong','FangSong','STFangsong','仿宋','Noto Serif SC',serif)
 *  3. Galgame风格底部对话槽 + 玩家对话选择按钮
 *  4. 移动端适配: 避开Home条安全区, 44px+交互热区
 *  5. 等待期: 边缘微弱灯光闪烁, 中央独白气泡
 *  6. 结局: 西式公函风格 (藏青配色 + 公文字体 + 钢印)
 *  7. z-index: 600 (高于其他overlay的500, 确保覆盖一切)
 * ═══════════════════════════════════════════════════════════
 */

/* ========== 字体变量 ========== */
:root {
  --ig-font-fangsong: 'GovFangSong','FangSong','STFangsong','仿宋','Noto Serif SC',serif;
  --ig-font-song: 'GovSong','STSong','SimSun','宋体','Noto Serif SC',serif;
  --ig-font-heiti: 'GovHeiTi','SimHei','黑体','Noto Sans SC',sans-serif;
  --ig-red: #c00000;
  --ig-red-dim: rgba(192, 0, 0, 0.5);
  --ig-red-faint: rgba(192, 0, 0, 0.2);
}

/* ========== Overlay 容器 ========== */
#interrogation-overlay {
  position: fixed;
  inset: 0;
  background: #000 url('../assets/interrogation_mobile_bg.png') center center / cover no-repeat;
  display: none;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-end;
  z-index: 600;
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  font-family: var(--ig-font-fangsong);
}
/* PC端使用专用背景图 */
@media (min-width: 768px) {
  #interrogation-overlay {
    background: #000 url('../assets/interrogation_pc_bg.png') center center / cover no-repeat;
  }
}
/* 背景图上叠加暗色遮罩, 保证文字可读性 */
#interrogation-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0.4) 40%, rgba(0,0,0,0.85) 100%);
  pointer-events: none;
  z-index: 0;
}
#interrogation-content {
  position: relative;
  z-index: 1;
}
#interrogation-overlay.active {
  display: flex;
  animation: igFadeIn 0.4s ease forwards;
}
@keyframes igFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ========== 内容区域 ========== */
#interrogation-content {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

/* ========== Galgame 对话槽 ========== */
.ig-dialogue-box {
  position: relative;
  width: 100%;
  max-width: 600px;
  margin: 0 auto;
  background: rgba(15, 15, 18, 0.92);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  border-top: 1px solid rgba(80, 80, 90, 0.3);
  padding: 24px 28px calc(24px + var(--safe-bottom));
  min-height: 160px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-sizing: border-box;
  font-family: var(--ig-font-fangsong);
}
.ig-speaker {
  font-size: 15px;
  font-weight: 700;
  color: rgba(200, 200, 210, 0.9);
  letter-spacing: 0.06em;
  line-height: 1.5;
  font-family: var(--ig-font-fangsong);
}
.ig-speaker-narration {
  color: rgba(120, 120, 130, 0.7);
  font-weight: 400;
}
.ig-text {
  font-size: 17px;
  line-height: 2.0;
  color: rgba(230, 230, 235, 0.95);
  letter-spacing: 0.02em;
  flex: 1;
  min-height: 24px;
  word-break: break-word;
  font-family: var(--ig-font-fangsong);
}
.ig-text-dimmed {
  opacity: 0.45;
  font-size: 15px;
  line-height: 1.9;
  min-height: 0;
  flex: 0 0 auto;
  margin-bottom: 4px;
}
.ig-continue-hint {
  position: absolute;
  bottom: calc(16px + var(--safe-bottom));
  right: 28px;
  color: rgba(140, 140, 150, 0.6);
  transition: opacity 0.3s;
}
.ig-pulse {
  animation: igPulse 1.5s ease-in-out infinite;
}
@keyframes igPulse {
  0%, 100% { opacity: 0.4; transform: translateY(0); }
  50% { opacity: 0.7; transform: translateY(2px); }
}

/* ========== 玩家对话选择 ========== */
.ig-dialogue-choice-box {
  border-top: 1px solid var(--ig-red-faint);
  background: rgba(18, 14, 14, 0.94);
}
.ig-choice-prompt {
  font-size: 13px;
  color: rgba(180, 160, 160, 0.55);
  text-align: center;
  margin-bottom: 6px;
  letter-spacing: 0.1em;
  font-family: var(--ig-font-fangsong);
}
.ig-choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  padding: 4px 0 0;
}
.ig-choice-btn {
  display: block;
  width: 100%;
  padding: 14px 20px;
  font-family: var(--ig-font-fangsong);
  font-size: 16px;
  line-height: 1.6;
  color: rgba(230, 225, 225, 0.92);
  background: rgba(32, 28, 28, 0.85);
  border: 1px solid rgba(120, 110, 110, 0.3);
  border-left: 3px solid var(--ig-red-dim);
  border-radius: 2px;
  cursor: pointer;
  text-align: left;
  letter-spacing: 0.04em;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  min-height: 48px;
  box-sizing: border-box;
}
.ig-choice-btn:hover {
  background: rgba(48, 28, 28, 0.9);
  border-left-color: var(--ig-red);
  border-color: var(--ig-red-faint);
  color: rgba(255, 250, 250, 1);
}
.ig-choice-btn:active {
  transform: scale(0.985);
  background: rgba(60, 20, 20, 0.95);
  border-left-color: var(--ig-red);
}
.ig-choice-btn:focus {
  outline: none;
  box-shadow: 0 0 0 1px var(--ig-red-faint);
}

/* ========== 漫长等待期 ========== */
.ig-wait-container {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ig-wait-timer {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 2px;
  background: rgba(100, 100, 110, 0.15);
  border-radius: 50%;
}
.ig-monologue-area {
  position: relative;
  width: 80%;
  max-width: 400px;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ========== 心理独白气泡 ========== */
.ig-monologue-bubble {
  position: absolute;
  top: 50%;
  left: 50%;
  font-size: 15px;
  line-height: 1.8;
  color: rgba(180, 180, 190, 0.7);
  text-align: center;
  letter-spacing: 0.04em;
  opacity: 0;
  transition: opacity 1.2s ease;
  max-width: 90%;
  pointer-events: none;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.8);
  font-family: var(--ig-font-fangsong);
}
.ig-monologue-visible {
  opacity: 0.75;
}
.ig-monologue-fading {
  opacity: 0;
  transition: opacity 1.5s ease;
}

/* ========== 边缘灯光闪烁 ========== */
.ig-edge-flicker {
  position: fixed;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s ease;
}
.ig-edge-top {
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(to bottom, rgba(120, 120, 140, 0.15), transparent);
}
.ig-edge-bottom {
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(to top, rgba(120, 120, 140, 0.15), transparent);
}
.ig-edge-left {
  top: 0; bottom: 0; left: 0;
  width: 3px;
  background: linear-gradient(to right, rgba(120, 120, 140, 0.15), transparent);
}
.ig-edge-right {
  top: 0; bottom: 0; right: 0;
  width: 3px;
  background: linear-gradient(to left, rgba(120, 120, 140, 0.15), transparent);
}

/* ========== 结果显示 (西式公函风格) ========== */
.ig-result-container {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 40px 24px;
  text-align: center;
}
.ig-result-doc {
  width: 100%;
  max-width: 420px;
  background: rgba(14, 10, 10, 0.92);
  border: 1px solid var(--ig-red-faint);
  border-top: 3px solid var(--ig-red-dim);
  padding: 30px 26px 28px;
  text-align: center;
  font-family: var(--ig-font-fangsong);
  box-shadow: 0 0 40px rgba(192, 0, 0, 0.08), 0 8px 32px rgba(0, 0, 0, 0.6);
  position: relative;
  box-sizing: border-box;
}
.ig-result-issuer {
  font-family: var(--ig-font-song);
  font-size: 17px;
  font-weight: 700;
  color: var(--ig-red);
  letter-spacing: 4px;
  line-height: 1.5;
  margin-bottom: 6px;
  opacity: 0;
  animation: igResultIn 0.7s ease 0.1s forwards;
}
.ig-result-redline {
  height: 2px;
  background: var(--ig-red);
  margin: 2px 0 20px;
  position: relative;
  opacity: 0;
  animation: igResultIn 0.7s ease 0.3s forwards;
}
.ig-result-redline::after {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 3px;
  height: 1px;
  background: var(--ig-red);
}
.ig-result-title {
  font-family: var(--ig-font-song);
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 0.15em;
  line-height: 1.4;
  margin-bottom: 18px;
  opacity: 0;
  animation: igResultIn 0.8s ease 0.5s forwards;
}
.ig-result-severe {
  color: var(--ig-red);
  text-shadow: 0 0 16px rgba(192, 0, 0, 0.3);
}
.ig-result-mild {
  color: rgba(210, 170, 100, 0.92);
  text-shadow: 0 0 14px rgba(210, 170, 100, 0.2);
}
.ig-result-text {
  font-size: 15px;
  line-height: 2.0;
  color: rgba(225, 215, 215, 0.88);
  letter-spacing: 0.02em;
  max-width: 340px;
  margin: 0 auto 16px;
  font-family: var(--ig-font-fangsong);
  opacity: 0;
  animation: igResultIn 0.8s ease 0.9s forwards;
}
.ig-result-summary {
  font-size: 13px;
  line-height: 1.9;
  color: rgba(190, 170, 170, 0.65);
  border-top: 1px solid var(--ig-red-faint);
  padding-top: 14px;
  margin-top: 4px;
  font-family: var(--ig-font-fangsong);
  text-align: left;
  text-indent: 2em;
  opacity: 0;
  animation: igResultIn 0.8s ease 1.4s forwards;
}
.ig-result-seal {
  margin-top: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  animation: igResultIn 0.8s ease 1.9s forwards;
}
.ig-result-seal-inner {
  width: 64px;
  height: 64px;
  border: 2.5px solid var(--ig-red);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--ig-font-song);
  font-size: 11px;
  color: var(--ig-red);
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 1px;
  opacity: 0.7;
  transform: rotate(-8deg);
}
.ig-result-seal-inner span {
  display: block;
}
@keyframes igResultIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========== 移动端适配优化 ========== */
@media (max-width: 480px) {
  .ig-dialogue-box {
    padding: 20px 20px calc(20px + var(--safe-bottom));
    min-height: 140px;
  }
  .ig-text {
    font-size: 16px;
    line-height: 2.0;
  }
  .ig-text-dimmed {
    font-size: 14px;
  }
  .ig-speaker {
    font-size: 14px;
  }
  .ig-continue-hint {
    bottom: calc(12px + var(--safe-bottom));
    right: 20px;
  }
  .ig-choice-btn {
    padding: 12px 16px;
    font-size: 15px;
    min-height: 44px;
  }
  .ig-choice-prompt {
    font-size: 12px;
  }
  .ig-monologue-bubble {
    font-size: 14px;
  }
  .ig-result-doc {
    padding: 24px 20px 22px;
    max-width: 100%;
  }
  .ig-result-title {
    font-size: 22px;
  }
  .ig-result-text {
    font-size: 14px;
  }
  .ig-result-issuer {
    font-size: 15px;
    letter-spacing: 3px;
  }
  .ig-result-summary {
    font-size: 12px;
  }
}

/* ========== 大屏/平板端 ========== */
@media (min-width: 768px) {
  .ig-dialogue-box {
    max-width: 700px;
    border-radius: 16px 16px 0 0;
    padding: 32px 36px calc(28px + var(--safe-bottom));
    min-height: 180px;
  }
  .ig-text {
    font-size: 18px;
  }
  .ig-choice-btn {
    font-size: 17px;
    padding: 16px 24px;
  }
  .ig-monologue-area {
    max-width: 500px;
    height: 250px;
  }
  .ig-result-doc {
    max-width: 460px;
    padding: 36px 32px 32px;
  }
  .ig-result-title {
    font-size: 30px;
  }
}

/* ========== 高对比度模式 (户外强光) ========== */
@media (prefers-contrast: high), (prefers-color-scheme: light) {
  .ig-dialogue-box {
    background: rgba(10, 10, 12, 0.98);
  }
  .ig-text {
    color: rgba(240, 240, 245, 1);
  }
  .ig-speaker {
    color: rgba(220, 220, 230, 1);
  }
  .ig-choice-btn {
    background: rgba(20, 16, 16, 0.95);
    color: rgba(245, 240, 240, 1);
  }
}
