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

body {
  font-family: 'Press Start 2P', monospace;
  background-color: #000055;
  color: #AAAAAA;
  min-height: 100vh;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%23FFFF55' d='M5 2v16l4-4h2l2 6h3l-2-6h4L5 2z'/%3E%3Cpath fill='%23AA5500' d='M6 3v13l3-3h2l2 6h1l-2-6h5L6 3z'/%3E%3C/svg%3E") 5 2, pointer;
}

/* Scanline overlay */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.12) 0px,
    rgba(0, 0, 0, 0.12) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
  z-index: 9999;
}

/* CRT curvature effect */
#root {
  position: relative;
}

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

@keyframes scanline-sweep {
  0% { top: -100%; }
  100% { top: 200%; }
}

@keyframes flash-red {
  0%, 49% { color: #FF0055; }
  50%, 100% { color: #FF55AA; }
}

@keyframes crt-flicker {
  0% { opacity: 1; }
  5% { opacity: 0.85; }
  10% { opacity: 1; }
  15% { opacity: 0.9; }
  20% { opacity: 1; }
  100% { opacity: 1; }
}

@keyframes glitch {
  0% { transform: translate(0); filter: none; }
  10% { transform: translate(-3px, 2px); filter: hue-rotate(90deg); }
  20% { transform: translate(3px, -2px); filter: hue-rotate(180deg) saturate(2); }
  30% { transform: translate(-2px, -1px); filter: hue-rotate(270deg); }
  40% { transform: translate(2px, 1px); filter: hue-rotate(45deg) brightness(1.5); }
  50% { transform: translate(-1px, 2px); filter: invert(0.2); }
  60% { transform: translate(1px, -1px); filter: hue-rotate(135deg); }
  70% { transform: translate(0); filter: none; }
  100% { transform: translate(0); filter: none; }
}

@keyframes static-noise {
  0% { background-position: 0 0; }
  25% { background-position: -50px 30px; }
  50% { background-position: 20px -60px; }
  75% { background-position: -30px 50px; }
  100% { background-position: 0 0; }
}

@keyframes dither-fade {
  0% { opacity: 0; filter: contrast(2) brightness(0.5); }
  50% { opacity: 0.7; filter: contrast(1.5) brightness(0.8); }
  100% { opacity: 1; filter: contrast(1) brightness(1); }
}

@keyframes progress-pulse {
  0%, 100% { text-shadow: 0 0 4px #55FF55; }
  50% { text-shadow: 0 0 8px #55FF55, 0 0 16px #00AA00; }
}

.blink-cursor {
  animation: blink-cursor 1s infinite;
}

.flash-nsfw {
  animation: flash-red 0.5s infinite, crt-flicker 2s infinite;
}

.glitch-effect {
  animation: glitch 0.6s ease-in-out;
}

.dither-in {
  animation: dither-fade 0.8s ease-out forwards;
}

.gallery-item {
  position: relative;
  overflow: hidden;
  image-rendering: pixelated;
}

.gallery-item::after {
  content: '';
  position: absolute;
  top: -100%;
  left: 0;
  width: 100%;
  height: 50%;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(255, 255, 255, 0.08) 50%,
    transparent 100%
  );
  pointer-events: none;
  transition: none;
}

.gallery-item:hover::after {
  animation: scanline-sweep 0.8s ease-in-out;
}

.gallery-item:hover {
  filter: brightness(1.2);
}

.gallery-item img {
  image-rendering: pixelated;
}

/* Dithered shadow */
.dithered-shadow {
  box-shadow:
    4px 4px 0px #000022,
    8px 8px 0px rgba(0, 0, 34, 0.5);
}

/* VGA border colors */
.vga-border-blue {
  border: 4px solid #0000AA;
  outline: 2px solid #000055;
}

.vga-border-purple {
  border: 4px solid #AA00AA;
  outline: 2px solid #550055;
}

/* DOS window chrome */
.dos-window {
  background: #0000AA;
  border: 2px solid #AAAAAA;
  box-shadow:
    inset 1px 1px 0 #FFFFFF,
    inset -1px -1px 0 #555555,
    4px 4px 0 #000022;
}

.dos-titlebar {
  background: linear-gradient(90deg, #0000AA, #0055AA);
  padding: 4px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #AAAAAA;
}

/* Retro button */
.retro-btn {
  font-family: 'Press Start 2P', monospace;
  background: #AAAAAA;
  color: #000000;
  border: none;
  box-shadow:
    inset 1px 1px 0 #FFFFFF,
    inset -1px -1px 0 #555555;
  padding: 8px 16px;
  cursor: pointer;
  image-rendering: pixelated;
}

.retro-btn:hover {
  background: #FFFFFF;
}

.retro-btn:active {
  box-shadow:
    inset -1px -1px 0 #FFFFFF,
    inset 1px 1px 0 #555555;
}

/* Static noise overlay for mode switch */
.static-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  background-size: 256px 256px;
  animation: static-noise 0.1s steps(4) infinite;
  opacity: 0.8;
}

/* Progress bar */
.progress-bar-fill {
  animation: progress-pulse 1s infinite;
}

/* Lightbox overlay */
.lightbox-overlay {
  background: rgba(0, 0, 20, 0.92);
}

/* Loading placeholder */
@keyframes loading-dots {
  0%, 20% { content: 'LOADING.'; }
  40% { content: 'LOADING..'; }
  60% { content: 'LOADING...'; }
  80%, 100% { content: 'LOADING....'; }
}

.loading-placeholder {
  background: #000033;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555599;
  font-size: 8px;
}

/* Dialog box */
.dos-dialog {
  background: #0000AA;
  border: 3px double #FFFFFF;
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.5);
  color: #FFFFFF;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 16px;
}
::-webkit-scrollbar-track {
  background: #000033;
  border-left: 2px solid #0000AA;
}
::-webkit-scrollbar-thumb {
  background: #AAAAAA;
  border: 2px solid #555555;
}

/* Responsive */
@media (max-width: 640px) {
  body {
    font-size: 7px;
  }
}