.glitch {
  animation: glitch-skew 0.3s infinite linear;
}

@keyframes glitch-skew {
  0% { transform: skew(0deg); }
  20% { transform: skew(2deg); }
  40% { transform: skew(-1deg); }
  60% { transform: skew(0.5deg); }
  80% { transform: skew(-2deg); }
  100% { transform: skew(0deg); }
}

.glitch-scanlines {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 9995;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.12) 2px,
    rgba(0, 0, 0, 0.12) 4px
  );
}

.crt-flicker {
  animation: flicker 0.15s infinite;
}

@keyframes flicker {
  0% { opacity: 1; }
  50% { opacity: 0.97; }
  100% { opacity: 1; }
}

.corrupted-text {
  color: #ff0000;
  text-shadow: 2px 0 #00ff00, -2px 0 #ff00ff;
  letter-spacing: -1px;
  animation: corrupt-shake 0.1s infinite;
}

@keyframes corrupt-shake {
  0% { transform: translate(0, 0); }
  25% { transform: translate(1px, -1px); }
  50% { transform: translate(-1px, 1px); }
  75% { transform: translate(1px, 1px); }
  100% { transform: translate(0, 0); }
}

.glitch-flash {
  position: absolute;
  inset: 0;
  z-index: 9997;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}

.glitch-flash-active {
  animation: glitch-flash 0.1s ease-out;
}

@keyframes glitch-flash {
  0% { opacity: 0.9; }
  100% { opacity: 0; }
}

.glitch-vignette {
  position: absolute;
  inset: 0;
  z-index: 9994;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 70%, rgba(0, 0, 0, 0.25) 100%);
}

.glitch-canvas {
  position: absolute;
  inset: 0;
  z-index: 9996;
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: 0.7;
}

#game {
  transition: filter 0.05s linear;
}

/* ── Horror Blackout Overlay ── */
.horror-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.horror-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.horror-overlay-line {
  color: #ff0000;
  font-family: 'Courier New', Consolas, monospace;
  font-size: 28px;
  font-weight: bold;
  text-shadow: 0 0 12px rgba(255, 0, 0, 0.6), 0 0 30px rgba(255, 0, 0, 0.2);
  text-align: center;
  max-width: 80%;
  animation: horror-pulse 1.2s ease-in-out infinite;
}

.horror-overlay-sub {
  color: #cc0000;
  font-family: 'Courier New', Consolas, monospace;
  font-size: 14px;
  text-shadow: 0 0 6px rgba(200, 0, 0, 0.3);
  text-align: center;
  max-width: 70%;
  opacity: 0.7;
}

.horror-overlay-line.corrupted {
  animation: horror-glitch 0.15s infinite;
  letter-spacing: -2px;
}

@keyframes horror-pulse {
  0%, 100% { opacity: 1; text-shadow: 0 0 12px rgba(255,0,0,0.6); }
  50% { opacity: 0.4; text-shadow: 0 0 25px rgba(255,0,0,0.9), 0 0 50px rgba(255,0,0,0.3); }
}

@keyframes horror-glitch {
  0% { transform: translate(-2px, 0) skewX(-1deg); }
  20% { transform: translate(2px, -1px) skewX(1deg); }
  40% { transform: translate(-1px, 1px) skewX(0deg); }
  60% { transform: translate(1px, 2px) skewX(-1deg); }
  80% { transform: translate(-2px, -1px) skewX(1deg); }
  100% { transform: translate(0, 1px) skewX(0deg); }
}

/* ── CMD Window ── */
.window-cmd .window-content {
  background: #0a0a0a;
  padding: 0;
}

.cmd-output {
  margin: 0;
  padding: 10px;
  background: #0a0a0a;
  color: #00ff00;
  font-family: 'Courier New', 'Consolas', monospace;
  font-size: 13px;
  line-height: 1.4;
  height: 100%;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  border: 1px inset #222;
  box-sizing: border-box;
  user-select: text;
  cursor: var(--cursor-text), text;
}

.cmd-output::-webkit-scrollbar {
  width: 8px;
}

.cmd-output::-webkit-scrollbar-track {
  background: #050505;
}

.cmd-output::-webkit-scrollbar-thumb {
  background: #00ff00;
  border: 1px solid #003300;
}

.window-cmd .window-titlebar {
  background: linear-gradient(90deg, #001100, #002200, #001100);
  border-bottom: 1px solid #00ff00;
}

.window-cmd .window-title {
  color: #00ff00;
  text-shadow: 0 0 4px rgba(0,255,0,0.3);
}

.window-cmd .window-btn-close {
  background: #0a0a0a;
  border: 1px solid #00ff00;
  color: #00ff00;
}

.window-cmd .window-btn-close:hover {
  background: #003300;
}

/* ── SLEEP OVERLAY TEXT ── */
.sleep-text {
  color: #333;
  font-family: 'Courier New', monospace;
  font-size: 18px;
  animation: sleepPulse 4s ease-in-out infinite;
}
@keyframes sleepPulse {
  0%, 100% { opacity: 0.08; }
  50% { opacity: 0.2; }
}

.sleep-text--wake {
  color: #444;
  font-size: 28px;
  font-weight: bold;
  animation: wakeTextFade 2s ease-out;
}
@keyframes wakeTextFade {
  0% { opacity: 0; }
  100% { opacity: 0.6; }
}
