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

body {
  font-family: 'VT323', monospace;
  background: var(--bg-color, #0a0a14);
  color: var(--text-color, #ffffff);
  overflow-x: hidden;
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16"><rect x="0" y="0" width="16" height="16" fill="white" stroke="black" stroke-width="1"/></svg>'), auto;
}

.app {
  min-height: 100vh;
  position: relative;
}

/* Background stars */
.stars {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(2px 2px at 20px 30px, white, transparent),
    radial-gradient(2px 2px at 60px 70px, white, transparent),
    radial-gradient(1px 1px at 50px 50px, white, transparent),
    radial-gradient(1px 1px at 130px 80px, white, transparent),
    radial-gradient(2px 2px at 90px 10px, white, transparent);
  background-repeat: repeat;
  background-size: 200px 200px;
  opacity: 0.3;
  animation: twinkle 3s infinite;
  pointer-events: none;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.5; }
}

/* Scanlines */
.scanlines {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0) 50%,
    rgba(0, 0, 0, 0.3) 50%
  );
  background-size: 100% 4px;
  pointer-events: none;
  z-index: 1000;
  animation: scanline 8s linear infinite;
}

@keyframes scanline {
  0% { transform: translateY(0); }
  100% { transform: translateY(4px); }
}

/* Matrix rain easter egg */
.matrix-rain {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    var(--primary-color) 0px,
    transparent 2px,
    transparent 4px,
    var(--primary-color) 6px
  );
  opacity: 0.5;
  animation: matrix-fall 0.5s linear infinite;
  pointer-events: none;
  z-index: 999;
}

@keyframes matrix-fall {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(0); }
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  position: relative;
  z-index: 2;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 3rem;
  padding: 2rem 0;
}

.header h1 {
  font-family: 'Press Start 2P', monospace;
  font-size: 2rem;
  color: var(--primary-color);
  text-shadow: 
    0 0 10px var(--primary-color),
    0 0 20px var(--primary-color),
    0 0 30px var(--secondary-color),
    3px 3px 0 var(--secondary-color);
  letter-spacing: 0.2rem;
  margin-bottom: 1rem;
  animation: flicker 3s infinite alternate;
}

@keyframes flicker {
  0%, 100% { opacity: 1; }
  41%, 43% { opacity: 0.8; }
  45%, 47% { opacity: 0.9; }
}

.glitch-text {
  position: relative;
}

.subtitle {
  font-size: 1.5rem;
  color: var(--accent-color);
  text-shadow: 0 0 5px var(--accent-color);
  letter-spacing: 0.5rem;
  text-transform: uppercase;
}

/* Portrait section */
.portrait-section {
  text-align: center;
  margin-bottom: 3rem;
}

.loading-container {
  padding: 3rem;
}

.loading-text {
  font-family: 'Press Start 2P', monospace;
  font-size: 1.5rem;
  color: var(--primary-color);
  text-shadow: 0 0 10px var(--primary-color);
  margin-bottom: 2rem;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.progress-bar {
  width: 100%;
  max-width: 400px;
  height: 30px;
  margin: 0 auto 1rem;
  border: 3px solid var(--primary-color);
  box-shadow: 
    0 0 10px var(--primary-color),
    inset 0 0 10px rgba(0, 0, 0, 0.5);
  position: relative;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(
    90deg,
    var(--primary-color),
    var(--secondary-color),
    var(--accent-color)
  );
  box-shadow: 0 0 20px var(--primary-color);
  transition: width 0.3s ease;
  animation: progress-shimmer 2s linear infinite;
}

@keyframes progress-shimmer {
  0% { filter: brightness(1); }
  50% { filter: brightness(1.5); }
  100% { filter: brightness(1); }
}

.loading-percentage {
  font-family: 'Press Start 2P', monospace;
  color: var(--secondary-color);
  font-size: 1.2rem;
}

.portrait-container {
  display: inline-block;
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.5s ease;
  padding: 1.5rem;
  border: 4px solid var(--primary-color);
  box-shadow: 
    0 0 20px var(--primary-color),
    0 0 40px var(--secondary-color),
    inset 0 0 20px rgba(0, 0, 0, 0.5);
  position: relative;
  background: rgba(0, 0, 0, 0.5);
}

.portrait-container.show {
  opacity: 1;
  transform: scale(1);
  animation: crt-on 0.8s ease;
}

@keyframes crt-on {
  0% {
    transform: scaleY(0.01) scaleX(1);
    filter: brightness(5);
  }
  50% {
    transform: scaleY(0.5) scaleX(1);
    filter: brightness(3);
  }
  100% {
    transform: scaleY(1) scaleX(1);
    filter: brightness(1);
  }
}

.portrait-container.glitch {
  animation: glitch-effect 0.3s;
}

@keyframes glitch-effect {
  0%, 100% { transform: translate(0); }
  20% { transform: translate(-5px, 5px); }
  40% { transform: translate(5px, -5px); }
  60% { transform: translate(-5px, -5px); }
  80% { transform: translate(5px, 5px); }
}

.portrait-canvas {
  display: block;
  max-width: 100%;
  height: auto;
  filter: contrast(1.1) brightness(1.1);
}

.quote {
  margin-top: 2rem;
  font-size: 1.3rem;
  color: var(--accent-color);
  text-shadow: 0 0 5px var(--accent-color);
  font-style: italic;
  cursor: pointer;
  transition: all 0.3s ease;
}

.quote:hover {
  color: var(--primary-color);
  text-shadow: 0 0 10px var(--primary-color);
  transform: scale(1.05);
}

/* Controls */
.controls {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 3rem;
}

.control-btn, .palette-select {
  font-family: 'Press Start 2P', monospace;
  padding: 0.8rem 1.5rem;
  font-size: 0.8rem;
  background: rgba(0, 0, 0, 0.7);
  color: var(--primary-color);
  border: 2px solid var(--primary-color);
  cursor: pointer;
  transition: all 0.3s ease;
  text-shadow: 0 0 5px var(--primary-color);
  box-shadow: 0 0 10px var(--primary-color);
}

.control-btn:hover, .palette-select:hover {
  background: var(--primary-color);
  color: var(--bg-color);
  box-shadow: 0 0 20px var(--primary-color);
  transform: translateY(-2px);
}

.control-btn:active, .palette-select:active {
  transform: translateY(0);
}

.palette-select {
  padding: 0.8rem 1rem;
}

/* Projects grid */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}

.project-card {
  background: rgba(0, 0, 0, 0.7);
  border: 3px solid var(--primary-color);
  padding: 0;
  text-decoration: none;
  color: var(--text-color);
  transition: all 0.3s ease;
  box-shadow: 0 0 10px var(--primary-color);
  position: relative;
  overflow: hidden;
}

.project-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s ease;
}

.project-card:hover::before {
  left: 100%;
}

.project-card:hover {
  transform: translateY(-5px);
  box-shadow: 
    0 0 20px var(--primary-color),
    0 0 40px var(--secondary-color);
  border-color: var(--secondary-color);
}

.card-header {
  background: rgba(0, 0, 0, 0.9);
  padding: 0.8rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--primary-color);
}

.card-icon-img {
  width: 48px;
  height: 48px;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

.window-controls {
  display: flex;
  gap: 0.5rem;
}

.control-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-color);
  box-shadow: 0 0 5px var(--accent-color);
}

.card-body {
  padding: 2rem 1rem;
  text-align: center;
}

.card-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.9rem;
  color: var(--primary-color);
  text-shadow: 0 0 5px var(--primary-color);
}

/* Footer */
.footer {
  text-align: center;
  padding: 2rem 0;
  border-top: 2px solid var(--primary-color);
  margin-top: 3rem;
}

.ascii-art {
  font-family: 'Press Start 2P', monospace;
  color: var(--accent-color);
  text-shadow: 0 0 5px var(--accent-color);
  margin: 1rem 0;
  font-size: 1.2rem;
}

.footer p {
  font-size: 1.2rem;
  color: var(--text-color);
}

.footer a {
  color: var(--primary-color);
  text-decoration: none;
  text-shadow: 0 0 5px var(--primary-color);
  transition: all 0.3s ease;
}

.footer a:hover {
  color: var(--accent-color);
  text-shadow: 0 0 10px var(--accent-color);
}

/* Responsive */
@media (max-width: 768px) {
  .header h1 {
    font-size: 1.2rem;
    letter-spacing: 0.1rem;
  }

  .subtitle {
    font-size: 1rem;
    letter-spacing: 0.3rem;
  }

  .portrait-container {
    padding: 1rem;
  }

  .portrait-canvas {
    width: 300px;
    height: 300px;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }

  .control-btn, .palette-select {
    font-size: 0.6rem;
    padding: 0.6rem 1rem;
  }

  .quote {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .header h1 {
    font-size: 0.9rem;
  }

  .portrait-canvas {
    width: 250px;
    height: 250px;
  }
}