/* ============================================================================
   PROTOCOL: DO NOT LOOK (ПРОТОКОЛ: НЕ СМОТРИ) — v3.0 EXPANDED EDITION
   Psychological Horror VHS / CRT / Diegetic Styling
   ============================================================================ */

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #020304;
  color: #d6e4dc;
  font-family: "Courier New", Courier, monospace;
}

#viewport {
  position: fixed;
  inset: 0;
  z-index: 1;
}

/* Subtle CRT Scanline & Vignette Film Pass */
#crt-overlay {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background:
    radial-gradient(circle at center, rgba(0,0,0,0) 45%, rgba(0,0,0,0.84) 100%),
    repeating-linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0.0) 0px,
      rgba(0, 0, 0, 0.0) 2px,
      rgba(0, 0, 0, 0.24) 3px,
      rgba(0, 0, 0, 0.24) 4px
    );
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   START / CALIBRATION SCREEN
   ========================================================================== */
#start-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  background:
    linear-gradient(180deg, rgba(2, 6, 4, 0.72) 0%, rgba(2, 5, 4, 0.88) 100%),
    url("assets/images/title_bg.png") center center / cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.calib-card {
  width: 100%;
  max-width: 700px;
  background: rgba(5, 11, 9, 0.92);
  backdrop-filter: blur(6px);
  border: 1px solid #2b6644;
  box-shadow: 0 0 80px rgba(0, 0, 0, 0.96), inset 0 0 28px rgba(20, 80, 50, 0.18);
  padding: 34px 40px;
  position: relative;
}

.dossier-badge {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 2px;
  color: #ff5555;
  border: 1px solid rgba(255, 70, 70, 0.45);
  background: rgba(60, 8, 8, 0.45);
  padding: 3px 9px;
  margin-bottom: 10px;
}

.lang-bar {
  position: absolute;
  top: 18px;
  right: 22px;
  display: flex;
  gap: 8px;
}

.lang-btn {
  background: #0a1410;
  color: #6a8f7b;
  border: 1px solid #234734;
  padding: 4px 10px;
  font-family: inherit;
  font-weight: bold;
  cursor: pointer;
}

.lang-btn.active {
  background: #1c4430;
  color: #55ff99;
  border-color: #44cc77;
}

#title-main {
  font-size: 32px;
  letter-spacing: 3px;
  color: #55ff99;
  text-shadow: 0 0 14px rgba(85, 255, 153, 0.35);
  margin-bottom: 8px;
}

#title-sub {
  font-size: 13px;
  color: #ff4d4d;
  letter-spacing: 1.5px;
  margin-bottom: 22px;
}

#calib-desc {
  font-size: 14px;
  line-height: 1.6;
  color: #b4c8bc;
  margin-bottom: 22px;
  border-left: 3px solid #2b6644;
  padding-left: 14px;
}

.calib-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.sys-btn {
  background: #0d1d16;
  color: #79e2a5;
  border: 1px solid #2b6644;
  padding: 13px 18px;
  font-family: inherit;
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.sys-btn:hover:not(:disabled) {
  background: #173829;
  border-color: #55ff99;
  color: #ffffff;
}

.sys-btn.linked {
  background: #112b1e;
  color: #55ff99;
  border-color: #55ff99;
}

.start-btn {
  width: 100%;
  background: #7a1212;
  color: #ffffff;
  border: 1px solid #ff4444;
  padding: 16px;
  font-family: inherit;
  font-size: 17px;
  font-weight: bold;
  letter-spacing: 2px;
  cursor: pointer;
  box-shadow: 0 0 24px rgba(255, 40, 40, 0.3);
  transition: all 0.15s ease;
}

.start-btn:hover {
  background: #a31919;
  box-shadow: 0 0 32px rgba(255, 60, 60, 0.55);
}

#controls-hint {
  margin-top: 18px;
  font-size: 11.5px;
  color: #7c9687;
  text-align: center;
}

/* ==========================================================================
   DIEGETIC HUD
   ========================================================================== */
#hud {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}

.hud-top-left {
  position: absolute;
  top: 22px;
  left: 26px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rec-badge {
  font-size: 13px;
  font-weight: bold;
  color: #e0ece6;
  letter-spacing: 1.5px;
  background: rgba(0, 0, 0, 0.65);
  padding: 6px 12px;
  border-left: 3px solid #ff2a2a;
}

.rec-dot {
  color: #ff2a2a;
  animation: pulseRec 1.6s infinite;
}

@keyframes pulseRec {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.meter-box {
  background: rgba(0, 0, 0, 0.65);
  padding: 6px 12px;
  width: 245px;
  border: 1px solid rgba(85, 255, 153, 0.28);
}

.meter-label {
  font-size: 11px;
  color: #8ab89e;
  margin-bottom: 4px;
}

.meter-track {
  width: 100%;
  height: 7px;
  background: #0d1a14;
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  width: 10%;
  background: linear-gradient(90deg, #22cc66, #ffaa22, #ff2222);
  transition: width 0.08s linear;
}

.hud-top-right {
  position: absolute;
  top: 22px;
  right: 26px;
  max-width: 440px;
  background: rgba(4, 10, 8, 0.82);
  border: 1px solid #2b5c41;
  padding: 12px 16px;
}

#obj-header {
  font-size: 11px;
  color: #55ff99;
  letter-spacing: 1.5px;
  margin-bottom: 5px;
}

#obj-text {
  font-size: 14px;
  color: #ffffff;
  line-height: 1.45;
}

#obj-text.urgent {
  color: #ff4444;
  font-weight: bold;
}

#crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  background: rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

#interact-prompt {
  position: absolute;
  top: 56%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(5, 14, 10, 0.9);
  border: 1px solid #55ff99;
  color: #55ff99;
  padding: 8px 18px;
  font-size: 15px;
  font-weight: bold;
  letter-spacing: 1px;
  box-shadow: 0 0 18px rgba(85, 255, 153, 0.25);
}

#subtitle-box {
  position: absolute;
  bottom: 44px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 780px;
  width: 88%;
  text-align: center;
  background: rgba(0, 0, 0, 0.82);
  border-top: 1px solid rgba(255, 255, 255, 0.22);
  padding: 12px 20px;
  font-size: 16px;
  line-height: 1.5;
  color: #f0f6f2;
}

/* Polaroid Snapshot PiP in bottom-right corner */
#polaroid-pip {
  position: absolute;
  bottom: 28px;
  right: 28px;
  background: #e8e4d9;
  padding: 10px 10px 28px 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.85);
  transform: rotate(-3deg);
}

#polaroid-pip.develop canvas {
  animation: developPhoto 1.8s ease-out forwards;
}

@keyframes developPhoto {
  0% { filter: brightness(2.6) contrast(0.3) grayscale(1); }
  100% { filter: brightness(1.0) contrast(1.15) sepia(0.18); }
}

.polaroid-caption {
  color: #222;
  font-size: 11px;
  font-weight: bold;
  text-align: center;
  margin-top: 6px;
}

/* ==========================================================================
   TERMINAL MODAL (ACT I & ACT IV)
   ========================================================================== */
#terminal-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(0, 0, 0, 0.84);
  display: flex;
  align-items: center;
  justify-content: center;
}

.crt-frame {
  background: #0a120e;
  border: 6px solid #222b26;
  box-shadow: 0 0 70px rgba(0, 0, 0, 0.95), 0 0 25px rgba(50, 255, 130, 0.15);
  padding: 18px;
  max-width: 850px;
  width: 94%;
}

#terminal-canvas {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid #2b6644;
  cursor: none;
}

.term-footer {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: #55ff99;
}

.term-mini-btn {
  background: #102a1d;
  color: #77ffaa;
  border: 1px solid #358856;
  padding: 4px 10px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: bold;
  cursor: pointer;
}

.term-mini-btn:hover {
  background: #1b4630;
  color: #ffffff;
  border-color: #55ff99;
}

.dual-feed-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.dual-feed-grid canvas {
  width: 100%;
  height: auto;
  border: 1px solid #ff3333;
  background: #040a06;
}

.act4-warning-banner {
  background: #2b0505;
  border: 2px solid #ff3333;
  color: #ffffff;
  padding: 14px;
  text-align: center;
}

.act4-warning-banner h3 {
  color: #ff4444;
  font-size: 18px;
  margin-bottom: 6px;
}

#act4-countdown {
  font-size: 26px;
  font-weight: bold;
  color: #ffdd44;
  margin-top: 6px;
}

/* ==========================================================================
   PEEPHOLE MODAL (ACT II)
   ========================================================================== */
#peephole-modal {
  position: fixed;
  inset: 0;
  z-index: 32;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.peephole-lens {
  width: 520px;
  height: 520px;
  border-radius: 50%;
  overflow: hidden;
  border: 14px solid #2b2112;
  box-shadow: inset 0 0 90px #000000, 0 0 120px rgba(0,0,0,0.95);
  position: relative;
}

.peephole-lens img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: contrast(1.2) brightness(0.82);
  animation: peepholeBreathe 4s ease-in-out infinite;
}

@keyframes peepholeBreathe {
  0%, 100% { transform: scale(1.04); }
  50% { transform: scale(1.1); }
}

/* ==========================================================================
   DOSSIER MODAL & CLOSET SCARE OVERLAY
   ========================================================================== */
#dossier-modal {
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgba(0, 0, 0, 0.86);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.dossier-frame {
  max-width: 820px;
  width: 94%;
  background: #08120d;
  border: 2px solid #2b6644;
  padding: 14px;
  box-shadow: 0 0 80px rgba(0, 0, 0, 0.96);
}

.dossier-frame img {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid #3c2b1e;
}

.dossier-caption {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: #55ff99;
}

#closet-scare-modal {
  position: fixed;
  inset: 0;
  z-index: 58;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#closet-scare-modal img {
  width: 106%;
  height: 106%;
  object-fit: cover;
  animation: climaxLunge 0.95s cubic-bezier(0.15, 0.9, 0.25, 1) forwards;
}

/* ==========================================================================
   CLIMAX SCARE OVERLAY (ACT V — NO STROBE, PURE VISCERAL LUNGE)
   ========================================================================== */
#climax-scare-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#climax-scare-overlay img {
  width: 108%;
  height: 108%;
  object-fit: cover;
  animation: climaxLunge 1.65s cubic-bezier(0.15, 0.9, 0.25, 1) forwards;
}

@keyframes climaxLunge {
  0% { transform: scale(1.0) rotate(-2deg); filter: contrast(1.35) brightness(1.1); }
  25% { transform: scale(1.18) rotate(2.5deg); }
  55% { transform: scale(1.26) rotate(-1.5deg); }
  100% { transform: scale(1.34) rotate(0deg); filter: contrast(1.5) brightness(0.75); }
}

/* ==========================================================================
   ENDING EVALUATION REPORT (ACT V EPILOGUE)
   ========================================================================== */
#ending-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: radial-gradient(circle at center, #08130e 0%, #020403 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.report-card {
  max-width: 820px;
  width: 100%;
  background: #06100b;
  border: 1px solid #33ff88;
  padding: 28px 32px;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.95);
}

.report-header {
  border-bottom: 1px solid #2b6644;
  padding-bottom: 12px;
  margin-bottom: 18px;
}

.report-header h2 {
  color: #55ff99;
  font-size: 23px;
  letter-spacing: 2px;
}

.report-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 22px;
  align-items: center;
}

.stats-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  background: #0b1c14;
  padding: 9px 14px;
  border-left: 3px solid #55ff99;
  font-size: 13.5px;
}

.stat-val {
  color: #55ff99;
  font-weight: bold;
}

.telemetry-graph-box {
  background: #050f0a;
  border: 1px solid #235036;
  padding: 4px;
}

#fear-graph-canvas {
  width: 100%;
  height: auto;
  display: block;
}

.reaction-frame {
  background: #0d1a14;
  border: 1px solid #2b6644;
  padding: 10px;
  text-align: center;
}

.reaction-frame img {
  width: 100%;
  height: auto;
  border: 1px solid #ff3333;
  display: block;
  margin-bottom: 8px;
}

.report-actions {
  margin-top: 20px;
  display: flex;
  gap: 14px;
}

.report-actions button {
  flex: 1;
}
