@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@300;400;500;600;700&display=swap');

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

body {
  background: #000;
  color: #00FF41;
  font-family: 'Fira Code', 'Courier New', monospace;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

#root {
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

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

.crt-screen {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* CRT Flicker */
@keyframes flicker {
  0% { opacity: 1; }
  3% { opacity: 0.95; }
  6% { opacity: 1; }
  7% { opacity: 0.92; }
  8% { opacity: 1; }
  50% { opacity: 1; }
  52% { opacity: 0.97; }
  53% { opacity: 1; }
  100% { opacity: 1; }
}

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

/* Glow text */
.glow-green {
  text-shadow: 0 0 8px #00FF41, 0 0 20px #00FF4133;
}

.glow-amber {
  text-shadow: 0 0 8px #FFB000, 0 0 20px #FFB00033;
}

.glow-red {
  text-shadow: 0 0 8px #FF0040, 0 0 20px #FF004033;
}

.glow-cyan {
  text-shadow: 0 0 8px #00FFFF, 0 0 20px #00FFFF33;
}

/* Blink cursor */
@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

.blink-cursor::after {
  content: '█';
  animation: blink 1s infinite;
}

/* Typewriter */
@keyframes typewriter {
  from { width: 0; }
  to { width: 100%; }
}

/* Matrix rain */
.matrix-rain {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  opacity: 0.06;
}

/* Pulse red timer */
@keyframes pulseRed {
  0%, 100% { color: #FF0040; text-shadow: 0 0 8px #FF0040; }
  50% { color: #FF4060; text-shadow: 0 0 20px #FF0040; }
}

.pulse-red {
  animation: pulseRed 1s infinite;
}

/* Radar sweep */
@keyframes radarSweep {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.radar-sweep {
  animation: radarSweep 2s linear infinite;
}

/* Button styles */
.terminal-btn {
  background: transparent;
  border: 1px solid #00FF41;
  color: #00FF41;
  font-family: 'Fira Code', monospace;
  padding: 6px 16px;
  cursor: pointer;
  text-shadow: 0 0 8px #00FF41;
  transition: all 0.2s;
}

.terminal-btn:hover {
  background: #00FF4120;
  box-shadow: 0 0 15px #00FF4133;
}

.terminal-btn:active {
  background: #00FF4140;
}

.terminal-btn.danger {
  border-color: #FF0040;
  color: #FF0040;
  text-shadow: 0 0 8px #FF0040;
}

.terminal-btn.danger:hover {
  background: #FF004020;
}

.terminal-btn.amber {
  border-color: #FFB000;
  color: #FFB000;
  text-shadow: 0 0 8px #FFB000;
}

/* Input styles */
.terminal-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid #00FF41;
  color: #00FF41;
  font-family: 'Fira Code', monospace;
  font-size: 14px;
  padding: 4px;
  outline: none;
  text-shadow: 0 0 8px #00FF41;
  caret-color: #00FF41;
}

.terminal-input::placeholder {
  color: #00FF4144;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: #0a0a0a;
}
::-webkit-scrollbar-thumb {
  background: #00FF4140;
  border-radius: 3px;
}

/* Window chrome for different OS styles */
.win1-window {
  border: 2px solid #C0C0C0;
  background: #000;
  box-shadow: 2px 2px 0 #808080;
}

.win1-titlebar {
  background: #000080;
  color: #fff;
  padding: 2px 4px;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.win11-window {
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(0, 255, 65, 0.2);
  box-shadow: 0 8px 32px rgba(0, 255, 65, 0.1);
}

.win12-window {
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(30px);
  border: 1px solid transparent;
  background-clip: padding-box;
  position: relative;
}

.win12-window::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 17px;
  padding: 1px;
  background: linear-gradient(135deg, #00FF41, #00FFFF, #FFB000, #FF0040);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: borderRotate 3s linear infinite;
}

@keyframes borderRotate {
  to { filter: hue-rotate(360deg); }
}

/* Puzzle grid cells */
.puzzle-cell {
  border: 1px solid #00FF4140;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'Fira Code', monospace;
}

.puzzle-cell:hover {
  background: #00FF4120;
  border-color: #00FF41;
}

.puzzle-cell.selected {
  background: #00FF4130;
  border-color: #00FF41;
  box-shadow: 0 0 10px #00FF4133;
}

/* Pipe segments for maze */
.pipe-segment {
  width: 100%;
  height: 100%;
  cursor: pointer;
  transition: transform 0.2s;
}

/* Achievement unlock animation */
@keyframes achievementSlide {
  0% { transform: translateX(100%); opacity: 0; }
  10% { transform: translateX(0); opacity: 1; }
  90% { transform: translateX(0); opacity: 1; }
  100% { transform: translateX(100%); opacity: 0; }
}

.achievement-popup {
  animation: achievementSlide 4s ease-in-out;
}

/* Loading bar */
@keyframes loadingPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

.loading-pulse {
  animation: loadingPulse 1.5s infinite;
}

/* Shake effect for errors */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
  20%, 40%, 60%, 80% { transform: translateX(4px); }
}

.shake {
  animation: shake 0.5s;
}

/* Progress bar glow */
.progress-fill {
  position: relative;
  overflow: hidden;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  to { left: 100%; }
}