/* assets/css/horror.css */
/* ARG専用：段階的ホラー演出、公的文書スタイル、第三閲覧アニメーション、エンディング */

/* 呼称バッジ変化（観測者・作品構成要素） */
.badge-observer {
  background: #1c1012 !important;
  border: 1px solid #991b1b !important;
  color: #fca5a5 !important;
  box-shadow: 0 0 10px rgba(220, 38, 38, 0.35) !important;
  animation: pulse-observer 2.5s infinite ease-in-out;
}

.badge-observer .user-badge-label {
  color: #fca5a5 !important;
  font-weight: 600 !important;
}

.badge-observer .user-badge-name {
  color: #ffffff !important;
  font-weight: 700 !important;
  text-shadow: 0 0 8px rgba(248, 113, 113, 0.8), 0 1px 2px rgba(0, 0, 0, 0.9) !important;
  letter-spacing: 0.04em;
}

.badge-element {
  background: #09090b !important;
  border: 1px solid #71717a !important;
  color: #e4e4e7 !important;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.15) !important;
  letter-spacing: 0.08em;
}

.badge-element .user-badge-label {
  color: #cbd5e1 !important;
  font-weight: 600 !important;
}

.badge-element .user-badge-name {
  color: #ffffff !important;
  font-weight: 700 !important;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.7), 0 1px 2px rgba(0, 0, 0, 0.9) !important;
}

@keyframes pulse-observer {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.2); }
  50% { box-shadow: 0 0 8px 2px rgba(220, 38, 38, 0.4); }
}

/* サウンド切替ボタン / 詳細調査ボタン */
.btn-sound-toggle {
  background: #ffffff;
  border: 1.5px solid #475569;
  color: #0f172a;
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-sound-toggle:hover {
  background: #f1f5f9;
  border-color: #0f172a;
  color: #000000;
}
.btn-sound-toggle.active {
  background: #0f172a;
  border-color: #38bdf8;
  color: #38bdf8;
}

/* 行政・公務文書（昭和〜平成初期） */
.official-document-box {
  background: #faf8f5;
  border: 1px solid #dcd5c9;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
  padding: 40px;
  border-radius: 2px;
  font-family: var(--font-serif);
  color: #2b261f;
  margin: 20px auto 40px;
  max-width: 860px;
  position: relative;
}

.official-stamp {
  position: absolute;
  top: 30px;
  right: 35px;
  border: 2px solid #b91c1c;
  color: #b91c1c;
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  transform: rotate(-4deg);
  border-radius: 4px;
  pointer-events: none;
}

.official-doc-header {
  border-bottom: 2px solid #2b261f;
  padding-bottom: 15px;
  margin-bottom: 25px;
}

.official-doc-no {
  font-size: 0.8rem;
  color: #6c6353;
  margin-bottom: 4px;
}

.official-doc-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a1714;
}

.official-log-table {
  width: 100%;
  border-collapse: collapse;
  margin: 25px 0;
  font-size: 0.92rem;
}

.official-log-table th,
.official-log-table td {
  border: 1px solid #c9c0b1;
  padding: 10px 14px;
  text-align: left;
}

.official-log-table th {
  background: #ede6d8;
  color: #3a3227;
  font-weight: 600;
}

.official-log-table tr.highlight-anomaly {
  background: #fdf2f2;
}

.official-log-table tr.highlight-anomaly td {
  color: #991b1b;
  font-weight: 600;
}

/* 黒塗り・墨消し演出 */
.redacted {
  background: #18181b;
  color: transparent;
  user-select: none;
  padding: 0 4px;
  border-radius: 2px;
  cursor: help;
  display: inline-block;
  line-height: 1.2;
}

/* 木村の手書き私物メモ（24P） */
.handwritten-memo-box {
  background: #fdfcf7;
  border: 1px solid #e0d8c3;
  padding: 35px;
  box-shadow: 2px 4px 16px rgba(45, 30, 10, 0.08);
  font-family: var(--font-serif);
  color: #26211a;
  line-height: 2.2;
  font-size: 1.05rem;
  max-width: 680px;
  margin: 30px auto;
  position: relative;
}

.handwritten-memo-box::before {
  content: "【私物メモ・引継書裏面に鉛筆書き】";
  display: block;
  font-size: 0.8rem;
  color: #8c826c;
  margin-bottom: 20px;
  border-bottom: 1px dashed #d5caa8;
  padding-bottom: 6px;
}

/* 古い台帳（29P：古文書・経年劣化風） */
.ancient-ledger-sheet {
  background: #24211e;
  border: 1px solid #423c34;
  color: #d1c7b7;
  padding: 40px;
  font-family: var(--font-serif);
  box-shadow: inset 0 0 60px rgba(0,0,0,0.6);
  border-radius: 4px;
  margin: 30px auto;
  max-width: 760px;
  line-height: 2.3;
}

.ancient-verses {
  font-size: 1.25rem;
  text-align: center;
  padding: 30px 15px;
  border-top: 1px solid #574e43;
  border-bottom: 1px solid #574e43;
  margin: 25px 0;
  color: #f1ebd8;
  letter-spacing: 0.15em;
}

/* 第三閲覧ステージ（33P〜35P） */
.third-view-wrapper {
  background: #040507;
  color: #e2e8f0;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.third-view-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px 20px;
  position: relative;
}

.stage-painting-container {
  position: relative;
  width: min(85vw, 560px);
  aspect-ratio: 3/4;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.9);
  border: 14px solid #1a1612;
  outline: 2px solid #2d261e;
  background: #09090b;
  overflow: hidden;
  transition: transform 1.2s ease, filter 0.8s ease;
}

.stage-painting-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 2.5s cubic-bezier(0.25, 1, 0.5, 1), filter 1.5s ease;
}

/* 第三閲覧：段階的変形クラス */
.stage-painting-img.step-gaze {
  transform: scale(1.04);
  filter: contrast(1.1) brightness(0.95);
}

.stage-painting-img.step-closer-1 {
  transform: scale(1.22) translateY(-2%);
  filter: contrast(1.2) brightness(0.9);
}

.stage-painting-img.step-closer-2 {
  transform: scale(1.65) translateY(-5%);
  filter: contrast(1.3) brightness(0.85);
}

/* 34P ジャンプスケア：急激な画面いっぱいの迫り・腕の出現 */
.stage-painting-img.step-jumpscare {
  transform: scale(2.8) translateY(-8%);
  filter: contrast(1.5) saturate(0.8) brightness(1.1);
  animation: tremor 0.08s infinite alternate;
}

@keyframes tremor {
  0% { transform: scale(2.8) translateY(-8%) translate(-4px, 2px); }
  100% { transform: scale(2.8) translateY(-8%) translate(4px, -2px); }
}

/* 額縁から伸びる異様な腕の疑似要素 */
.stage-painting-container::after {
  content: "";
  position: absolute;
  inset: -10%;
  background: radial-gradient(circle at center, rgba(0,0,0,0) 40%, rgba(0,0,0,0.85) 90%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.stage-painting-img.step-jumpscare ~ .painting-arm-shadow {
  opacity: 1;
  transform: scale(1);
}

.painting-arm-shadow {
  position: absolute;
  inset: -20px;
  border: 10px solid rgba(15, 10, 8, 0.95);
  box-shadow: inset 0 0 100px rgba(0,0,0,0.95);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}

/* 35P 耐えた後の解放演出 */
.stage-painting-img.step-turn-back {
  transform: scale(1.3) translateY(0);
  filter: contrast(1) brightness(0.9);
  transition: transform 3s ease, filter 2s ease;
}

.stage-painting-img.step-exchange {
  filter: brightness(1.15) contrast(0.95);
  transition: filter 2.5s ease;
}

/* 暗転オーバーレイ */
.stage-dark-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.stage-dark-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* グリッチ歪みビネット */
.glitch-vignette {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle, transparent 40%, rgba(185, 28, 28, 0.4) 100%);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: color-dodge;
  transition: opacity 0.2s ease;
}

.glitch-vignette.active {
  opacity: 1;
  animation: vignette-pulse 0.2s infinite alternate;
}

@keyframes vignette-pulse {
  0% { opacity: 0.6; }
  100% { opacity: 1; }
}

/* 中央の名前表示 */
.stage-name-display {
  position: absolute;
  top: 48%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-serif);
  font-size: 2.2rem;
  letter-spacing: 0.2em;
  color: #fff;
  opacity: 0;
  z-index: 80;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
  transition: opacity 1.5s ease;
  pointer-events: none;
}

.stage-name-display.visible {
  opacity: 1;
}

/* 「みつけた」メッセージ */
.stage-found-message {
  position: absolute;
  top: 58%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-serif);
  font-size: 1.5rem;
  letter-spacing: 0.3em;
  color: #f87171;
  opacity: 0;
  z-index: 80;
  text-shadow: 0 0 15px rgba(239, 68, 68, 0.9);
  transition: opacity 1.2s ease;
  pointer-events: none;
}

.stage-found-message.visible {
  opacity: 1;
}

/* UI消失クラス */
.ui-dissolve {
  opacity: 0 !important;
  pointer-events: none !important;
  transition: opacity 1.5s ease !important;
}

/* 34P トラップ警告モーダル（OS／ブラウザ警告風） */
.trap-warning-modal.hidden {
  display: none !important;
}

.trap-warning-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 120;
  background: #ffffff;
  color: #0f172a;
  border-radius: 8px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.9), 0 0 0 2px rgba(220, 38, 38, 0.5);
  width: min(90vw, 450px);
  overflow: hidden;
  font-family: system-ui, -apple-system, sans-serif;
  animation: modal-pop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* 引き摺り込み・吸い込みエフェクト */
.stage-drag-in-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 95;
  opacity: 0;
  background: radial-gradient(circle at center, transparent 30%, rgba(139, 0, 0, 0.6) 70%, rgba(0, 0, 0, 0.95) 100%);
  mix-blend-mode: multiply;
  transition: opacity 1.2s ease;
}

.stage-drag-in-overlay.active {
  opacity: 1;
  animation: drag-in-pulse 0.15s infinite alternate;
}

@keyframes drag-in-pulse {
  0% { transform: scale(1); filter: contrast(1.2); }
  100% { transform: scale(1.02); filter: contrast(1.5) saturate(1.4); }
}

/* 画面端から這い寄る影 */
.creeping-shadows {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 96;
  opacity: 0;
  box-shadow: inset 0 0 120px 60px rgba(0, 0, 0, 0.9), inset 0 0 50px 20px rgba(185, 28, 28, 0.5);
  transition: opacity 0.8s ease;
}

.creeping-shadows.active {
  opacity: 1;
}

@keyframes modal-pop {
  0% { transform: translate(-50%, -46%) scale(0.94); opacity: 0; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.trap-modal-header {
  background: #fef2f2;
  border-bottom: 1px solid #fee2e2;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.trap-modal-icon {
  font-size: 1.3rem;
  color: #dc2626;
}

.trap-modal-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: #991b1b;
  margin: 0;
}

.trap-modal-body {
  padding: 20px 18px;
  font-size: 0.9rem;
  line-height: 1.6;
  color: #334155;
}

.trap-modal-footer {
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  padding: 12px 18px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.btn-trap-exit {
  background: #dc2626;
  color: #ffffff;
  border: none;
  padding: 9px 20px;
  border-radius: 5px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-trap-exit:hover {
  background: #b91c1c;
}

/* 正常復旧ステータス */
.view-phase-status.restored {
  color: #38bdf8 !important;
  font-weight: 600;
  text-shadow: 0 0 10px rgba(56, 189, 248, 0.6);
}
