@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Pixelify+Sans:wght@400..700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');

:root{
  --crt-font-size: 22px;
  --crt-line-height: 32px;
  --crt-safe-top: 60px;
  --crt-safe-left: 40px;
  --crt-safe-right: 40px;
}

@media (max-width: 768px) {
  :root {
    --crt-font-size: 16px;
    --crt-line-height: 24px;
    --crt-safe-top: 30px;
    --crt-safe-left: 20px;
    --crt-safe-right: 20px;
  }
}

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

        body {
            background: #0a0e1a;
            font-family: 'VT323', monospace;
            color: #33ff66;
            padding: 40px 20px;
        }

        @media (max-width: 768px) {
            body {
                padding: 20px 10px;
            }
        }

        .hidden {
            display: none !important;
        }

        .timeline-header-block {
            margin: 70px auto 20px;
            width: min(1200px, calc(100% - 40px));
            text-align: center;
        }

        @media (max-width: 768px) {
            .timeline-header-block {
                margin: 30px auto 15px;
                width: calc(100% - 20px);
            }
        }

        .timeline-header {
            font-family: 'Press Start 2P', monospace;
            font-size: 1.5rem;
            color: #33ff66;
            margin: 0 0 10px;
            text-shadow: 0 0 15px rgba(51, 255, 102, 0.6);
            animation: glow-green 3s ease-in-out infinite;
        }

        @media (max-width: 768px) {
            .timeline-header {
                font-size: 1rem;
                line-height: 1.5;
            }
        }

        @keyframes glow-green {
            0%, 100% { filter: brightness(1); text-shadow: 0 0 15px rgba(51, 255, 102, 0.6); }
            50% { filter: brightness(1.3); text-shadow: 0 0 25px rgba(51, 255, 102, 0.8); }
        }

        .timeline-subtitle {
            font-family: 'VT323', monospace;
            font-size: 1.4rem;
            color: #66ff99;
            margin: 0;
            text-shadow: 0 2px 4px rgba(10, 14, 26, 0.85);
        }

        @media (max-width: 768px) {
            .timeline-subtitle {
                font-size: 1.1rem;
            }
        }
        
        .terminal-timeline,
.terminal-timeline * {
  font-family: 'VT323', monospace;
}

.terminal-timeline .hidden { display: none !important; }

        .terminal-timeline{
  position: relative;
  max-width: 900px;
  margin: 40px auto;
  border-radius: 14px;
  padding: 25px 30px 42px 30px;

  background:
    radial-gradient(120% 130% at 20% 0%,
      rgba(214, 201, 182, 0.85) 0%,
      rgba(214, 201, 182, 0.65) 35%,
      transparent 60%) ,
    radial-gradient(120% 130% at 100% 100%,
      rgba(186, 169, 146, 0.40) 0%,
      rgba(186, 169, 146, 0.00) 60%) ,
    linear-gradient(180deg, #d9d0c0 0%, #cfc2af 55%, #c6b8a3 100%);

  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.35),
    inset 0 -2px 4px rgba(0,0,0,0.18),
    inset 0 0 28px rgba(80,60,40,0.08),
    0 18px 40px rgba(0,0,0,0.35),
    0 60px 120px rgba(0,0,0,0.25);
}

@media (max-width: 768px) {
  .terminal-timeline {
    margin: 20px auto;
    padding: 15px 15px 35px 15px;
    border-radius: 10px;
  }
}

.terminal-timeline::before{
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background-image: url("../assets/noise-64.png");
  background-size: 64px 64px;
  background-repeat: repeat;
  mix-blend-mode: multiply;
  opacity: 0.05;
}

.terminal-timeline::after{
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background:
    radial-gradient(180px 160px at 16px 16px, rgba(0,0,0,0.20), transparent 60%),
    radial-gradient(220px 200px at calc(100% - 16px) 16px, rgba(0,0,0,0.18), transparent 65%),
    radial-gradient(220px 200px at 16px calc(100% - 16px), rgba(0,0,0,0.18), transparent 65%),
    radial-gradient(260px 220px at calc(100% - 16px) calc(100% - 16px), rgba(0,0,0,0.20), transparent 68%),
    repeating-linear-gradient(
      -14deg,
      rgba(255,255,255,0.06) 0px,
      rgba(255,255,255,0.06) 1px,
      transparent 1px,
      transparent 10px
    ),
    repeating-linear-gradient(
      14deg,
      rgba(0,0,0,0.05) 0px,
      rgba(0,0,0,0.05) 1px,
      transparent 1px,
      transparent 12px
    );
  opacity: 0.22;
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,0.06);
}

@media (hover:hover){
  .terminal-timeline::after{
    background-image:
      linear-gradient(to top, rgba(255,255,255,0.07), rgba(255,255,255,0) 40%),
      radial-gradient(180px 160px at 16px 16px, rgba(0,0,0,0.20), transparent 60%),
      radial-gradient(220px 200px at calc(100% - 16px) 16px, rgba(0,0,0,0.18), transparent 65%),
      radial-gradient(220px 200px at 16px calc(100% - 16px), rgba(0,0,0,0.18), transparent 65%),
      radial-gradient(260px 220px at calc(100% - 16px) calc(100% - 16px), rgba(0,0,0,0.20), transparent 68%),
      repeating-linear-gradient(-14deg, rgba(255,255,255,0.06) 0 1px, transparent 1px 10px),
      repeating-linear-gradient(14deg, rgba(0,0,0,0.05) 0 1px, transparent 1px 12px);
  }
}

.crt-screen {
  background: #001a0d;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  aspect-ratio: 1.4 / 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  z-index: 5;

  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.06),
    inset 0 -1px 0 rgba(0,0,0,0.35),
    0 0 30px rgba(51,255,102,0.30),
    inset 0 0 120px rgba(51,255,102,0.06);
}

@media (max-width: 768px) {
  .crt-screen {
    aspect-ratio: 1.2 / 1;
    border-radius: 8px;
  }
}

.crt-screen::before,
.crt-screen::after,
.screen-glare,
.screen-vignette {
  border-radius: inherit;
}

.crt-screen::before{
  content:'';
  position:absolute; inset:0; pointer-events:none; z-index:120;
  background-image:linear-gradient(to bottom, rgba(0,0,0,0.45) 1px, transparent 1px);
  background-size:100% 2px;
  animation:scanlines 30s linear infinite;
}
@keyframes scanlines{
  from{ background-position-y:0; }
  to  { background-position-y:240px; }
}

.crt-screen::after {
  content: '';
  position: absolute; inset: 0;
  pointer-events: none; z-index: 119;

  box-shadow: inset 0 0 0 3px #1e1e1e;
  background: rgba(51, 255, 102, 0.04);
  animation: flicker 0.08s infinite, brightness-pulse 1.5s ease-in-out infinite;
}

        @keyframes flicker {
            0% { opacity: 0.88; }
            10% { opacity: 0.95; }
            20% { opacity: 0.82; }
            30% { opacity: 0.98; }
            40% { opacity: 0.85; }
            50% { opacity: 1; }
            60% { opacity: 0.90; }
            70% { opacity: 0.96; }
            80% { opacity: 0.84; }
            90% { opacity: 0.92; }
            100% { opacity: 0.88; }
        }

        @keyframes brightness-pulse {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.75; }
        }

        .screen-glare {
            position: absolute;
            top: -50%;
            left: -50%;
            width: 200%;
            height: 200%;
            background: radial-gradient(
                ellipse at 35% 25%,
                rgba(255, 255, 255, 0.15) 0%,
                rgba(255, 255, 255, 0.08) 15%,
                rgba(102, 255, 153, 0.06) 25%,
                transparent 45%
            );
            pointer-events: none;
            z-index: 118;
            animation: glare-shift 6s ease-in-out infinite;
        }

        @keyframes glare-shift {
            0%, 100% { transform: translate(0, 0); opacity: 0.7; }
            50% { transform: translate(8%, 8%); opacity: 1; }
        }

        .screen-vignette {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: radial-gradient(
                ellipse at center,
                transparent 0%,
                transparent 60%,
                rgba(0, 0, 0, 0.4) 100%
            );
            pointer-events: none;
            z-index: 117;
        }

        .boot-screen {
            position: absolute;
            inset: 0;
            z-index: 12;
            padding: 40px;
            height: 100%;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            text-align: center;
            pointer-events: auto;
        }

        @media (max-width: 768px) {
            .boot-screen {
                padding: 20px 15px;
            }
        }

.boot-sequence-screen {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 5;
  font-family: 'VT323', monospace;
  font-size: var(--crt-font-size);
  line-height: var(--crt-line-height);
  color: #33ff66;
}
.boot-sequence-screen.active { display:block; }

.boot-viewport {
  position: absolute;
  top: var(--crt-safe-top);
  left: var(--crt-safe-left);
  right: var(--crt-safe-right);
  bottom: var(--crt-safe-top);
  overflow: hidden;
}

.boot-viewport::-webkit-scrollbar { width: 0; height: 0; }
.boot-viewport { scrollbar-width: none; }

/* Command terminal specific override */
.command-terminal .boot-viewport {
  overflow-y: auto !important;
  overflow-x: hidden;
}

/* Style the scrollbar for command terminal */
.command-terminal .boot-viewport::-webkit-scrollbar {
  width: 8px;
}

.command-terminal .boot-viewport::-webkit-scrollbar-track {
  background: #001a00;
}

.command-terminal .boot-viewport::-webkit-scrollbar-thumb {
  background: #33ff66;
  border-radius: 2px;
}

.boot-content {
  white-space: pre;
  padding-bottom: var(--crt-line-height);
}

        .ascii-logo {
            font-family: 'VT323', monospace;
            font-size: 0.8rem;
            line-height: 1;
            color: #33ff66;
            white-space: pre;
            text-shadow: 0 0 10px rgba(51, 255, 102, 0.5);
            margin-bottom: 30px;
            opacity: 0;
            animation: fadeIn 1s forwards;
            letter-spacing: 0.05em;
        }

        @media (max-width: 768px) {
            .ascii-logo {
                font-size: 0.45rem;
                margin-bottom: 15px;
                letter-spacing: 0;
            }
        }

        @keyframes fadeIn {
            to { opacity: 1; }
        }

        .boot-text {
            font-family: 'VT323', monospace;
            font-size: 1.3rem;
            color: #66ff99;
            margin-bottom: 10px;
            opacity: 0;
            animation: fadeIn 0.8s forwards;
            animation-delay: 1.2s;
        }

        @media (max-width: 768px) {
            .boot-text {
                font-size: 1rem;
            }
        }

        .boot-status {
            font-family: 'VT323', monospace;
            font-size: 1.2rem;
            color: #99ffcc;
            margin-bottom: 40px;
            opacity: 0;
            animation: fadeIn 0.8s forwards;
            animation-delay: 1.6s;
        }

        @media (max-width: 768px) {
            .boot-status {
                font-size: 0.95rem;
                margin-bottom: 25px;
            }
        }

        .enter-button {
            font-family: 'Press Start 2P', monospace;
            font-size: 0.9rem;
            color: #000000;
            background: #33ff66;
            border: 3px solid #33ff66;
            padding: 15px 40px;
            cursor: pointer;
            text-transform: uppercase;
            box-shadow: 0 0 20px rgba(51, 255, 102, 0.6);
            transition: all 0.3s ease;
            opacity: 0;
            animation: fadeIn 0.8s forwards, pulse-button 2s ease-in-out infinite;
            animation-delay: 2s;
        }

        @media (max-width: 768px) {
            .enter-button {
                font-size: 0.65rem;
                padding: 12px 25px;
                border: 2px solid #33ff66;
            }
        }

        .enter-button:hover {
            background: #66ff99;
            border-color: #66ff99;
            box-shadow: 0 0 30px rgba(102, 255, 153, 0.8);
            transform: scale(1.05);
        }

        @keyframes pulse-button {
            0%, 100% { box-shadow: 0 0 20px rgba(51, 255, 102, 0.6); }
            50% { box-shadow: 0 0 30px rgba(51, 255, 102, 0.8); }
        }

        .cursor-typing {
            display: inline-block;
            width: 10px;
            height: 18px;
            background: #33ff66;
            margin-left: 3px;
            animation: blink 0.8s step-end infinite;
        }

        @keyframes blink {
            0%, 50% { opacity: 1; }
            50.1%, 100% { opacity: 0; }
        }

        .crt-flicker {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(51, 255, 102, 0.3);
            pointer-events: none;
            z-index: 15;
            opacity: 0;
            animation: retrace 0.15s ease-out;
        }

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

        .terminal-screen-header {
            background: #001a00;
            border-bottom: 2px solid #33ff66;
            padding: 15px 20px;
            font-family: 'VT323', monospace;
            font-size: 0.8rem;
            color: #33ff66;
            text-align: center;
            position: relative;
            z-index: 5;
        }

        @media (max-width: 768px) {
            .terminal-screen-header {
                padding: 10px 15px;
                font-size: 0.65rem;
            }
        }

        .timeline-content {
            position: relative;
            z-index: 5;
            display: flex;
            flex-direction: column;
            height: 100%;
        }

        .timeline-scroll-area {
            flex: 1;
            overflow-y: auto;
            overflow-x: hidden;
            padding: 30px;
            font-family: 'VT323', monospace;
            font-size: 1.4rem;
            line-height: 1.6;
            color: #33ff66;
        }

        @media (max-width: 768px) {
            .timeline-scroll-area {
                padding: 20px 15px;
                font-size: 1.1rem;
            }
        }

        .timeline-scroll-area::-webkit-scrollbar {
            width: 12px;
        }

        .timeline-scroll-area::-webkit-scrollbar-track {
            background: #001a00;
            border-left: 1px solid #33ff66;
        }

        .timeline-scroll-area::-webkit-scrollbar-thumb {
            background: #33ff66;
        }

        .terminal-footer {
            background: #001a00;
            border-top: 2px solid #33ff66;
            padding: 15px 20px;
            display: flex;
            justify-content: center;
            z-index: 5;
        }

        @media (max-width: 768px) {
            .terminal-footer {
                padding: 12px 15px;
            }
        }

        .logout-button {
            font-family: 'Press Start 2P', monospace;
            font-size: 0.7rem;
            color: #000000;
            background: #33ff66;
            border: 2px solid #33ff66;
            padding: 10px 25px;
            cursor: pointer;
            text-transform: uppercase;
        }

        @media (max-width: 768px) {
            .logout-button {
                font-size: 0.55rem;
                padding: 8px 20px;
            }
        }

        .timeline-header-title {
            text-align: center;
            margin-bottom: 20px;
            padding-bottom: 20px;
            border-bottom: 2px solid #33ff66;
        }

        .timeline-header-title h2 {
            font-family: 'Press Start 2P', monospace;
            font-size: 1rem;
            color: #66ff99;
            margin-bottom: 15px;
            letter-spacing: 2px;
        }

        @media (max-width: 768px) {
            .timeline-header-title h2 {
                font-size: 0.75rem;
                letter-spacing: 1px;
                line-height: 1.5;
            }
        }

        .timeline-header-title .source-info {
            font-family: 'VT323', monospace;
            font-size: 1.2rem;
            color: #99ffcc;
            font-style: italic;
        }

        @media (max-width: 768px) {
            .timeline-header-title .source-info {
                font-size: 0.95rem;
            }
        }

        .timeline-entry {
            margin: 40px 0;
            padding: 20px 0;
            border-left: 3px solid #33ff66;
            padding-left: 25px;
        }

        @media (max-width: 768px) {
            .timeline-entry {
                margin: 25px 0;
                padding: 15px 0;
                padding-left: 15px;
                border-left-width: 2px;
            }
        }

        .timeline-period {
            color: #66ff99;
            font-size: 1.6rem;
            font-weight: bold;
            margin-bottom: 10px;
        }

        @media (max-width: 768px) {
            .timeline-period {
                font-size: 1.2rem;
            }
        }

        .timeline-period::before {
            content: '>>> ';
            color: #33ff66;
        }

        .timeline-title {
            color: #99ffcc;
            font-family: 'Press Start 2P', monospace;
            font-size: 0.9rem;
            line-height: 1.5;
            margin-bottom: 15px;
        }

        @media (max-width: 768px) {
            .timeline-title {
                font-size: 0.7rem;
                line-height: 1.6;
                margin-bottom: 10px;
            }
        }

        .timeline-text {
            color: #66ff99;
            font-size: 1.3rem;
            line-height: 1.8;
        }

        @media (max-width: 768px) {
            .timeline-text {
                font-size: 1rem;
                line-height: 1.6;
            }
        }

.pixel-corner {
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(51, 255, 102, 0.12);
  border-radius: 2px;
  z-index: 11;
  pointer-events: none;
}

        .pixel-corner.top-left {
            top: 8px;
            left: 8px;
            border-right: none;
            border-bottom: none;
        }

        .pixel-corner.top-right {
            top: 8px;
            right: 8px;
            border-left: none;
            border-bottom: none;
        }

        .pixel-corner.bottom-left {
            bottom: 8px;
            left: 8px;
            border-right: none;
            border-top: none;
        }

        .pixel-corner.bottom-right {
            bottom: 8px;
            right: 8px;
            border-left: none;
            border-top: none;
        }

        .terminal-brand {
            position: absolute;
            bottom: 16px;
            left: 50%;
            transform: translateX(-50%);
            font-family: 'Press Start 2P', monospace;
            font-size: 0.55rem;
            color: #6a6a5a;
            letter-spacing: 2px;
            text-transform: uppercase;
        }

        @media (max-width: 768px) {
            .terminal-brand {
                font-size: 0.35rem;
                letter-spacing: 0.5px;
                bottom: 14px;
            }
        }
        
.terminal-logo {
  position: absolute;
  right: 32px;
  bottom: -12px;
  pointer-events: none;
  opacity: 0.9;
  z-index: 1;
}

.terminal-logo img {
  height: 56px;
  width: auto;
  filter:
    drop-shadow(0 1px 0 rgba(255,255,255,0.25))
    drop-shadow(0 -1px 0 rgba(0,0,0,0.15));
  user-select: none;
}

@media (max-width: 768px) {
  .terminal-logo {
    right: 12px;
    bottom: -1px;
  }
  
  .terminal-logo img {
    height: 28px;
  }
}

        .control-panel {
            position: absolute;
            bottom: 10px;
            left: 35px;
            display: flex;
            gap: 15px;
            align-items: center;
        }

        @media (max-width: 768px) {
            .control-panel {
                left: 16px;
                bottom: 11px;
                gap: 6px;
            }
        }

        .control-label {
            font-family: 'VT323', monospace;
            font-size: 0.65rem;
            color: #5a5a4a;
            text-transform: uppercase;
        }

        @media (max-width: 768px) {
            .control-label {
                font-size: 0.4rem;
            }
        }

        .power-indicator {
            width: 10px;
            height: 10px;
            background: #33ff66;
            border-radius: 50%;
            animation: power-blink 2s ease-in-out infinite;
        }

        @media (max-width: 768px) {
            .power-indicator {
                width: 5px;
                height: 5px;
            }
        }

        @keyframes power-blink {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.5; }
        }

        .brightness-knob {
            width: 20px;
            height: 20px;
            background: radial-gradient(circle at 30% 30%, #8a8a7a, #4a4a3a);
            border-radius: 50%;
            border: 2px solid #3a3a2a;
            position: relative;
        }

        .brightness-knob::after {
            content: '';
            position: absolute;
            top: 2px;
            left: 50%;
            transform: translateX(-50%);
            width: 2px;
            height: 6px;
            background: #2a2a1a;
        }

        @media (max-width: 768px) {
            .brightness-knob {
                width: 10px;
                height: 10px;
                border-width: 1px;
            }
            
            .brightness-knob::after {
                width: 1px;
                height: 3px;
                top: 1px;
            }
        }
        
/* === Secret file / glitch effect === */
.secret-file {
  position: relative;
  display: inline-block;
  isolation: isolate;
  /* CRT-green base */
  color: #33ff66;
  text-shadow: 0 0 6px rgba(51,255,102,0.55);
  /* subtle jitter */
  animation: sf-skew 1.4s steps(16, end) infinite;
}

/* RGB split ghost layers */
.secret-file::before,
.secret-file::after{
  content: attr(data-text);
  position:absolute; inset:0;
  pointer-events:none;
  mix-blend-mode:screen;
}

.secret-file::before{
  transform: translate(-1px, 0);
  color:#ff3b3b;                /* red ghost */
  text-shadow: -1px 0 0 #ff3b3b;
  animation: sf-scan 2.2s steps(20, end) infinite;
  opacity:.65;
}

.secret-file::after{
  transform: translate(1px, 0);
  color:#3bc8ff;                /* blue ghost */
  text-shadow: 1px 0 0 #3bc8ff;
  animation: sf-scan 2.2s steps(18, end) infinite reverse;
  opacity:.65;
}

/* Occasional “censor bar” pass */
.secret-file .censor {
  position:absolute; left:-4px; right:-4px; top:0; bottom:0;
  pointer-events:none;
  mix-blend-mode:multiply;
  background:
    linear-gradient(transparent 0 48%,
                    rgba(0,0,0,.65) 48% 56%,
                    transparent 56% 100%);
  filter: blur(.2px);
  animation: sf-bar 1.8s steps(10, end) infinite;
  opacity:.85;
}

/* Tiny random skew/jitter */
@keyframes sf-skew{
  0%   { transform: translate(0,0) skew(0deg,0deg);   }
  10%  { transform: translate(0.2px,0) skew(0.2deg,0); }
  20%  { transform: translate(-0.4px,0) skew(-0.3deg); }
  30%  { transform: translate(0.6px,0) skew(0.4deg);  }
  40%  { transform: translate(-0.2px,0) skew(-0.2deg);}
  50%  { transform: translate(0.3px,0) skew(0.3deg);  }
  60%  { transform: translate(-0.5px,0) skew(-0.4deg);}
  70%  { transform: translate(0.4px,0) skew(0.2deg);  }
  80%  { transform: translate(-0.3px,0) skew(-0.3deg);}
  90%  { transform: translate(0.2px,0) skew(0.1deg);  }
  100% { transform: translate(0,0) skew(0deg,0deg);   }
}

/* Vertical scan-ish desync for the RGB ghosts */
@keyframes sf-scan{
  0%, 100% { clip-path: inset(0 0 0 0); }
  10%  { clip-path: inset(10% 0 0 0); }
  20%  { clip-path: inset(0 0 75% 0); }
  30%  { clip-path: inset(60% 0 0 0); }
  40%  { clip-path: inset(0 0 20% 0); }
  50%  { clip-path: inset(40% 0 0 0); }
  60%  { clip-path: inset(0 0 65% 0); }
  70%  { clip-path: inset(80% 0 0 0); }
  80%  { clip-path: inset(0 0 35% 0); }
  90%  { clip-path: inset(55% 0 0 0); }
}

/* Moves that censor bar up/down now and then */
@keyframes sf-bar{
  0%, 12%, 100% { transform: translateY(-30%); }
  13%           { transform: translateY(0%);    }
  18%           { transform: translateY(9%);   }
  22%           { transform: translateY(21%);   }
  26%           { transform: translateY(30%);  }
}

/* === Full overlay you can position anywhere on the screen === */
.screen-tear {
  position: fixed;           /* pinned to viewport; we'll set top/left/size via JS */
  pointer-events: none;
  z-index: 2147483647;
  mix-blend-mode: screen;
  opacity: .85;
  overflow: hidden;
  animation: tear-life 90ms linear both;
  will-change: transform, opacity;

  /* Soft edges: fade top/bottom (works in all modern browsers) */
  --tear-feather: 18px;
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0,
    black calc(var(--tear-feather) + 1px),
    black calc(100% - var(--tear-feather) - 1px),
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    transparent 0,
    black calc(var(--tear-feather) + 1px),
    black calc(100% - var(--tear-feather) - 1px),
    transparent 100%
  );
}

/* your two moving bands; unchanged vibe, slightly softer */
.screen-tear::before,
.screen-tear::after {
  content:"";
  position:absolute; left:0; right:0;       /* no overspill needed */
  height:18%;
  background: linear-gradient(
    to right,
    rgba(80,255,120,.35),
    rgba(80,255,120,.05) 40%,
    rgba(80,255,120,.35)
  );
  filter: blur(.5px) contrast(120%);        /* slightly more blur = less harsh edges inside */
  animation: tear-shift 120ms linear both;
  will-change: transform, opacity;
}
.screen-tear::before { top:22%; }
.screen-tear::after  { top:62%; animation-delay: 8ms; }

/* same animations you had */
@keyframes tear-shift{
  0%   { transform: translateX(0);    opacity:.85; }
  50%  { transform: translateX(12px); opacity:.6;  }
  100% { transform: translateX(0);    opacity:0;   }
}
@keyframes tear-life{
  0%   { opacity:1; }
  100% { opacity:0; }
}


.alert-flash{
  position:absolute; inset:0;
  background:radial-gradient(circle, rgba(255,0,0,0.25), transparent 70%);
  animation: flashFade 0.25s ease-out;
  pointer-events:none;
}
@keyframes flashFade{ from{opacity:1;} to{opacity:0;} }

.text-ghost{
  position:absolute;
  color:rgba(51,255,102,0.25);
  filter:blur(1px);
  transform:translateY(-2px);
  animation: ghostFade 0.7s ease-out forwards;
}
@keyframes ghostFade{
  from{opacity:0.5;}
  to{opacity:0; transform:translateY(-6px);}
}

@keyframes crt-idle {
  0%, 97%, 100% { opacity: 0; }
  98% { opacity: 1; }
}
.idle-flicker::after {
  content: "_";
  animation: crt-idle 18s infinite;
  position: absolute;
  bottom: 0;
  right: 0.6em;
  color: #33ff66;
  opacity: 0;
}

/* === Command Terminal Overlay === */
.command-terminal {
  position: absolute;
  inset: 0;
  z-index: 13;
  font-family: 'VT323', monospace;
  font-size: var(--crt-font-size);
  line-height: var(--crt-line-height);
  color: #33ff66;
  background: #001a0d;
  overflow: hidden;
}

.command-terminal.active {
  display: block;
}

/* Add this as a NEW rule after the .boot-viewport rules */
#cmdViewport {
  position: absolute;
  top: var(--crt-safe-top);
  left: var(--crt-safe-left);
  right: var(--crt-safe-right);
  bottom: var(--crt-safe-top);
  overflow-y: auto !important;  /* Force override with !important */
  overflow-x: hidden;
  z-index: 3;
}

/* Remove or comment out these if they exist for #cmdViewport */
/* #cmdViewport::-webkit-scrollbar { width: 0; height: 0; } */
/* #cmdViewport { scrollbar-width: none; } */

#cmdContent {
  white-space: pre-wrap; /* Changed from 'pre' to 'pre-wrap' for better line handling */
  padding-bottom: var(--crt-line-height);
  min-height: 100%; /* Ensure content can push scrollbar */
}

/* Enhanced glitch effect for red mode - SUPERCRITICAL */
.command-terminal.red-mode {
    animation: red-supercritical 0.15s infinite;
}

@keyframes red-supercritical {
    0% { 
        transform: translate(0, 0) scale(1) skew(0deg); 
        filter: hue-rotate(0deg) brightness(1) contrast(1);
    }
    10% {
        transform: translate(-1px, 0.5px) scale(1.003) skew(0.5deg);
        filter: hue-rotate(10deg) brightness(0.9) contrast(1.1);
    }
    20% { 
        transform: translate(0.5px, -0.5px) scale(0.997) skew(-0.3deg);
        filter: hue-rotate(-5deg) brightness(1.1) contrast(0.95);
    }
    30% {
        transform: translate(-0.5px, 0) scale(1.002) skew(0.2deg);
        filter: hue-rotate(3deg) brightness(0.95) contrast(1.05);
    }
    40% {
        transform: translate(0, 0.5px) scale(0.999) skew(-0.1deg);
        filter: hue-rotate(-8deg) brightness(1.05) contrast(0.98);
    }
    50% {
        transform: translate(0.5px, 0) scale(1.001) skew(0.3deg);
        filter: hue-rotate(15deg) brightness(0.92) contrast(1.08);
    }
    60% {
        transform: translate(0, -0.5px) scale(0.998) skew(-0.2deg);
        filter: hue-rotate(-12deg) brightness(1.08) contrast(0.96);
    }
    70% {
        transform: translate(-0.5px, 0.5px) scale(1.002) skew(0.1deg);
        filter: hue-rotate(7deg) brightness(0.94) contrast(1.03);
    }
    80% {
        transform: translate(0.5px, 0) scale(0.999) skew(-0.4deg);
        filter: hue-rotate(-3deg) brightness(1.02) contrast(0.99);
    }
    90% {
        transform: translate(0, 0) scale(1.001) skew(0.2deg);
        filter: hue-rotate(5deg) brightness(0.96) contrast(1.02);
    }
    100% {
        transform: translate(0, 0) scale(1) skew(0deg);
        filter: hue-rotate(0deg) brightness(1) contrast(1);
    }
}

/* Distortion overlay for meltdown effect */
.red-distortion {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 4;
    background: 
        repeating-linear-gradient(
            0deg,
            transparent 0,
            transparent 2px,
            rgba(255, 0, 0, 0.03) 2px,
            rgba(255, 0, 0, 0.03) 4px
        );
    animation: distortion-scan 0.5s linear infinite;
    mix-blend-mode: multiply;
}

@keyframes distortion-scan {
    0% { transform: translateY(0); }
    100% { transform: translateY(4px); }
}

/* Make the text itself glitch like SERN_TT_RESEARCH */
.command-terminal.red-mode #cmdContent {
    animation: text-meltdown 0.3s steps(5, end) infinite;
}

@keyframes text-meltdown {
    0%, 80% { 
        text-shadow: 
            1px 0 #ff0000,
            -1px 0 #00ffff,
            0 0 5px rgba(255, 0, 0, 0.5);
    }
    20% {
        text-shadow: 
            -2px 0 #ff00ff,
            2px 0 #00ff00,
            0 0 8px rgba(255, 0, 255, 0.6);
    }
    40% {
        text-shadow: 
            1px 0 #ffff00,
            -1px 0 #0000ff,
            0 0 3px rgba(255, 255, 0, 0.4);
    }
    60% {
        text-shadow: 
            -1px 0 #ff0000,
            1px 0 #00ffff,
            0 0 10px rgba(255, 0, 0, 0.7);
    }
}

/* More aggressive RGB drift */
.command-terminal.red-mode .red-mode-drift {
    animation: rgb-meltdown 0.8s ease-in-out infinite;
}

@keyframes rgb-meltdown {
    0%, 100% { 
        transform: translate(0, 0) rotate(0deg); 
        opacity: 0.15;
    }
    25% { 
        transform: translate(2px, -2px) rotate(0.5deg); 
        opacity: 0.25;
    }
    50% { 
        transform: translate(-2px, 2px) rotate(-0.5deg); 
        opacity: 0.2;
    }
    75% { 
        transform: translate(2px, 2px) rotate(0.3deg); 
        opacity: 0.18;
    }
}

/* === SERN Red Mode — classic base reintroduced, layered under current effects === */

/* 1) Deep red chassis background + red-tinted phosphor */
.command-terminal.red-mode {
  /* bring back the dark red base (overrides the green #001a0d) */
  background: #0d0000 !important;

  /* red terminal text vibe (keeps your newer animations) */
  color: #ff6666;
  text-shadow: 0 0 8px rgba(255, 102, 102, 0.6);
}

/* 2) Soft red wash below text (multiply keeps it tasteful) */
.command-terminal.red-mode::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(139, 0, 0, 0.15);   /* same tone as your previous version */
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: 1;                          /* sits under text and your higher overlays */
}

/* 3) Red scanlines drifting downward (subtle, sits over the wash) */
.command-terminal.red-mode::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to bottom, rgba(255, 0, 0, 0.05) 1px, transparent 1px);
  background-size: 100% 3px;
  animation: scanlines-red 25s linear infinite;
  pointer-events: none;
  z-index: 2;                          /* below your .red-distortion (z-index:4) & content */
}

@keyframes scanlines-red {
  from { background-position-y: 0; }
  to   { background-position-y: 300px; }
}

/* 4) Red cursor tint matches text in red mode */
.command-terminal.red-mode .cursor-typing {
  background: #ff6666;
  animation: blink 0.8s step-end infinite; /* keeps your existing blink keyframes */
}

/* 5) Optional: RGB drift “hotspots” layer (if you use a .red-mode-drift helper node) */
.red-mode-drift {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2; /* sits with scanlines; your .red-distortion is z-index:4 above this */
  animation: rgb-drift 3s ease-in-out infinite;
}
.red-mode-drift::before,
.red-mode-drift::after {
  content: '';
  position: absolute;
  inset: 0;
  mix-blend-mode: screen;
  opacity: 0.15;
}
.red-mode-drift::before {
  background: radial-gradient(circle at 30% 40%, rgba(255, 0, 0, 0.3), transparent 60%);
}
.red-mode-drift::after {
  background: radial-gradient(circle at 70% 60%, rgba(0, 100, 255, 0.2), transparent 60%);
}
@keyframes rgb-drift {
  0%, 100% { transform: translate(0, 0); }
  33%      { transform: translate(1px, -1px); }
  66%      { transform: translate(-1px, 1px); }
}

/* Terminal text effects */
.cmd-glitch-text {
  display: inline;
  animation: cmd-glitch 0.3s ease-in-out;
}

@keyframes cmd-glitch {
  0%, 100% { opacity: 1; transform: translate(0); }
  25% { opacity: 0.8; transform: translate(-1px, 0); }
  50% { opacity: 1; transform: translate(1px, 0); }
  75% { opacity: 0.9; transform: translate(0, -1px); }
}

/* Hide scrollbar visuals but keep programmatic scroll working */
.no-scrollbar {
  scrollbar-width: none;           /* Firefox */
  -ms-overflow-style: none;        /* IE/Edge legacy */
  overscroll-behavior: contain;    /* stop scroll chaining to body */
}
.no-scrollbar::-webkit-scrollbar { /* Chrome/Safari/Edge */
  display: none;
}

/* Hard scroll lock for the command viewport */
#cmdViewport.lock-scroll {
  overflow: hidden !important;     /* beats the existing auto !important */
  touch-action: none;              /* mobile gestures off */
  overscroll-behavior: contain;    /* no scroll chaining */
}

/* (optional) hide the bar too */
#cmdViewport.lock-scroll::-webkit-scrollbar { display: none; }
#cmdViewport.lock-scroll { scrollbar-width: none; }