/* === DOS TERMINAL - Green Phosphor CRT Theme === */

/* Reset & Base */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #000;
  font-family: 'VT323', monospace;
  color: #33ff33;
  font-size: 18px;
  line-height: 1.4;
}

/* === Main Screen Container === */
.dos-screen {
  position: relative;
  width: 100vw;
  height: 100vh;
  background: #000;
  overflow: hidden;
}

/* === CRT Scanlines Overlay === */
.scanlines {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.15) 0px,
    rgba(0, 0, 0, 0.15) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
  z-index: 10;
}

/* === CRT Flicker + Vignette === */
.crt-effect {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 11;
  background: radial-gradient(
    ellipse at center,
    transparent 60%,
    rgba(0, 0, 0, 0.4) 100%
  );
  animation: crt-flicker 0.1s infinite alternate;
}

@keyframes crt-flicker {
  0%   { opacity: 0.97; }
  100% { opacity: 1.0; }
}

/* === Terminal Content Area === */
.terminal-content {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 20px 24px 60px 24px;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 5;
}

/* Green Scrollbar */
.terminal-content::-webkit-scrollbar {
  width: 8px;
}

.terminal-content::-webkit-scrollbar-track {
  background: #0a0a0a;
}

.terminal-content::-webkit-scrollbar-thumb {
  background: #33ff33;
  border-radius: 0;
}

.terminal-content::-webkit-scrollbar-thumb:hover {
  background: #66ff66;
}

/* === Terminal Text === */
.terminal-text {
  font-family: 'VT323', monospace;
  font-size: 18px;
  line-height: 1.4;
  color: #33ff33;
  white-space: pre-wrap;
  word-wrap: break-word;
  margin: 0;
  padding: 0;
  text-shadow: 0 0 4px rgba(51, 255, 51, 0.4);
}

/* === Input Line === */
.terminal-input-line {
  display: flex;
  align-items: center;
  margin-top: 2px;
}

.terminal-prompt {
  font-family: 'VT323', monospace;
  font-size: 18px;
  color: #33ff33;
  white-space: pre;
  text-shadow: 0 0 4px rgba(51, 255, 51, 0.4);
  flex-shrink: 0;
}

/* Clickable area wraps input + cursor, takes remaining space */
.terminal-input-area {
  flex: 1;
  display: flex;
  align-items: center;
  cursor: text;
  min-height: 25px;
  margin-left: 4px;
}

.terminal-input {
  font-family: 'VT323', monospace;
  font-size: 18px;
  color: #33ff33;
  background: transparent;
  border: none;
  outline: none;
  width: 1ch;
  min-width: 0;
  max-width: 100%;
  padding: 0;
  caret-color: transparent;
  text-shadow: 0 0 4px rgba(51, 255, 51, 0.4);
}

.terminal-input::selection {
  background: #33ff33;
  color: #000;
}

/* === Blinking Block Cursor === */
.terminal-cursor {
  display: inline-block;
  width: 10px;
  height: 18px;
  background: #33ff33;
  vertical-align: text-bottom;
  animation: blink 1s step-end infinite;
  flex-shrink: 0;
  box-shadow: 0 0 4px rgba(51, 255, 51, 0.4);
}

.terminal-input-line.done .terminal-cursor {
  display: none;
}

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

/* === Matrix Rain Overlay === */
.matrix-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 100;
  background: #000;
}

.matrix-overlay canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.matrix-exit-hint {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: #33ff33;
  font-family: 'VT323', monospace;
  font-size: 16px;
  opacity: 0.5;
  z-index: 101;
  text-shadow: 0 0 6px rgba(51, 255, 51, 0.5);
}

/* === Glitch Effect === */
.glitch-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 200;
  pointer-events: none;
  animation: glitch-anim 0.3s steps(2) infinite;
  background: repeating-linear-gradient(
    0deg,
    transparent 0px,
    transparent 2px,
    rgba(51, 255, 51, 0.05) 2px,
    rgba(51, 255, 51, 0.05) 4px
  );
}

@keyframes glitch-anim {
  0%   { transform: translate(0, 0); clip-path: inset(20% 0 40% 0); }
  25%  { transform: translate(-4px, 2px); clip-path: inset(60% 0 10% 0); }
  50%  { transform: translate(4px, -2px); clip-path: inset(10% 0 70% 0); }
  75%  { transform: translate(-2px, -4px); clip-path: inset(50% 0 20% 0); }
  100% { transform: translate(0, 0); clip-path: inset(30% 0 50% 0); }
}

/* === Screen Shake === */
.screen-shake {
  animation: shake 0.5s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translate(0, 0); }
  10%  { transform: translate(-6px, 4px); }
  20%  { transform: translate(6px, -4px); }
  30%  { transform: translate(-4px, -6px); }
  40%  { transform: translate(4px, 6px); }
  50%  { transform: translate(-6px, -2px); }
  60%  { transform: translate(6px, 2px); }
  70%  { transform: translate(-2px, 6px); }
  80%  { transform: translate(2px, -6px); }
  90%  { transform: translate(-4px, 4px); }
}

/* === Color Utility Classes === */
.text-green  { color: #33ff33; }
.text-red    { color: #ff3333; }
.text-cyan   { color: #33ffff; }
.text-yellow { color: #ffff33; }
.text-white  { color: #ffffff; }
.text-gray   { color: #888888; }
.text-purple { color: #cc66ff; }
.text-orange { color: #ff9933; }

.text-dim {
  color: #1a8c1a;
  text-shadow: none;
}

.text-bright {
  color: #66ff66;
  text-shadow: 0 0 8px rgba(51, 255, 51, 0.6);
}

/* === Boot Sequence Styles === */
.boot-highlight {
  color: #66ff66;
  text-shadow: 0 0 8px rgba(51, 255, 51, 0.8);
}

/* === Rik Unlock Glow === */
.rik-unlock-text {
  color: #cc66ff;
  text-shadow: 0 0 10px rgba(204, 102, 255, 0.8), 0 0 20px rgba(204, 102, 255, 0.4);
  animation: rik-pulse 1.5s ease-in-out infinite alternate;
}

@keyframes rik-pulse {
  0%   { text-shadow: 0 0 10px rgba(204, 102, 255, 0.8), 0 0 20px rgba(204, 102, 255, 0.4); }
  100% { text-shadow: 0 0 16px rgba(204, 102, 255, 1.0), 0 0 30px rgba(204, 102, 255, 0.6); }
}

/* === Fade Transition for EXIT === */
.fade-out {
  animation: fade-out 1s ease-out forwards;
}

@keyframes fade-out {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}
