/* THCode Enhanced - Pixel Art Style */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Pixelify+Sans:wght@400;500;600;700&family=VT323&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  /* Enhanced Colors */
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-tertiary: #1a1a25;
  --bg-card: rgba(20, 20, 30, 0.9);

  --neon-green: #00ff88;
  --neon-cyan: #00ffff;
  --neon-pink: #ff1493;
  --neon-purple: #bf5af2;
  --neon-orange: #ff9f0a;
  --neon-yellow: #ffd60a;

  --pixel-size: 4px;
}

/* Pixel Font Classes */
.pixel-font {
  font-family: 'Press Start 2P', cursive;
  text-rendering: optimizeSpeed;
  image-rendering: pixelated;
}

.pixelify-font {
  font-family: 'Pixelify Sans', cursive;
}

.retro-font {
  font-family: 'VT323', monospace;
}

/* Pixelated Effects */
.pixelated {
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

/* Neon Glow Text */
.neon-text {
  text-shadow:
    0 0 5px currentColor,
    0 0 10px currentColor,
    0 0 20px currentColor,
    0 0 40px currentColor;
  animation: neonPulse 2s ease-in-out infinite;
}

@keyframes neonPulse {
  0%, 100% {
    text-shadow:
      0 0 5px currentColor,
      0 0 10px currentColor,
      0 0 20px currentColor;
  }
  50% {
    text-shadow:
      0 0 10px currentColor,
      0 0 20px currentColor,
      0 0 40px currentColor,
      0 0 60px currentColor;
  }
}

/* Pixel Border */
.pixel-border {
  position: relative;
  border: none !important;
  padding: 20px;
}

.pixel-border::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(0deg, var(--neon-green) 2px, transparent 2px) 0 0,
    linear-gradient(90deg, var(--neon-green) 2px, transparent 2px) 0 0,
    linear-gradient(180deg, var(--neon-green) 2px, transparent 2px) 0 100%,
    linear-gradient(270deg, var(--neon-green) 2px, transparent 2px) 100% 0;
  background-size: 8px 8px, 8px 8px, 8px 8px, 8px 8px;
  background-repeat: no-repeat;
  pointer-events: none;
}

/* Scanline Effect */
.scanlines {
  position: relative;
  overflow: hidden;
}

.scanlines::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 255, 136, 0.03) 0px,
    transparent 2px,
    transparent 4px
  );
  pointer-events: none;
  z-index: 1000;
  animation: scanline 10s linear infinite;
}

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

/* CRT Monitor Effect */
.crt-effect {
  animation: flicker 0.15s infinite;
}

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

/* Pixel Button */
.pixel-btn {
  position: relative;
  padding: 12px 24px;
  font-family: 'Press Start 2P', cursive;
  font-size: 0.7rem;
  text-transform: uppercase;
  background: var(--neon-green);
  color: #000;
  border: none;
  clip-path: polygon(
    0 0, calc(100% - 8px) 0, 100% 8px,
    100% 100%, 8px 100%, 0 calc(100% - 8px)
  );
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow:
    0 0 20px var(--neon-green),
    inset 0 0 10px rgba(0, 0, 0, 0.2);
}

.pixel-btn:hover {
  transform: scale(1.05);
  box-shadow:
    0 0 30px var(--neon-green),
    0 0 60px var(--neon-green),
    inset 0 0 10px rgba(0, 0, 0, 0.3);
}

.pixel-btn:active {
  transform: scale(0.98);
}

/* Animated Pixel Art Background */
.pixel-stars {
  position: fixed;
  width: 100%;
  height: 100%;
  background-image:
    radial-gradient(2px 2px at 20% 30%, white, transparent),
    radial-gradient(2px 2px at 60% 70%, white, transparent),
    radial-gradient(1px 1px at 50% 50%, white, transparent),
    radial-gradient(1px 1px at 80% 10%, white, transparent),
    radial-gradient(2px 2px at 90% 60%, white, transparent),
    radial-gradient(1px 1px at 30% 80%, white, transparent);
  background-size: 200% 200%;
  animation: pixelStarTwinkle 10s ease-in-out infinite;
  opacity: 0.3;
  pointer-events: none;
}

@keyframes pixelStarTwinkle {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 0.4; }
}

/* Retro Grid */
.retro-grid {
  position: fixed;
  width: 100%;
  height: 100%;
  background-image:
    linear-gradient(var(--neon-cyan) 1px, transparent 1px),
    linear-gradient(90deg, var(--neon-cyan) 1px, transparent 1px);
  background-size: 50px 50px;
  opacity: 0.05;
  perspective: 1000px;
  transform: rotateX(60deg);
  pointer-events: none;
}

/* Pixel Art Card */
.pixel-card {
  background: var(--bg-card);
  clip-path: polygon(
    0 4px, 4px 4px, 4px 0,
    calc(100% - 4px) 0, calc(100% - 4px) 4px, 100% 4px,
    100% calc(100% - 4px), calc(100% - 4px) calc(100% - 4px), calc(100% - 4px) 100%,
    4px 100%, 4px calc(100% - 4px), 0 calc(100% - 4px)
  );
  position: relative;
}

.pixel-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0, 255, 136, 0.1) 0%, transparent 50%);
  pointer-events: none;
}

/* Glitch GIF Animation */
.glitch-gif {
  animation: glitchAnimation 3s infinite;
}

@keyframes glitchAnimation {
  0%, 90%, 100% {
    transform: translate(0);
    filter: hue-rotate(0deg);
  }
  91% {
    transform: translate(-2px, 2px);
    filter: hue-rotate(90deg);
  }
  92% {
    transform: translate(2px, -2px);
    filter: hue-rotate(180deg);
  }
  93% {
    transform: translate(-2px, -2px);
    filter: hue-rotate(270deg);
  }
}

/* Pixel Art Achievement Badge */
.pixel-achievement {
  width: 64px;
  height: 64px;
  background: var(--bg-tertiary);
  clip-path: polygon(
    30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%
  );
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  position: relative;
  cursor: pointer;
  transition: all 0.3s ease;
}

.pixel-achievement::after {
  content: '';
  position: absolute;
  inset: -4px;
  clip-path: polygon(
    30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%
  );
  background: linear-gradient(45deg, var(--neon-green), var(--neon-cyan));
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.pixel-achievement:hover {
  transform: scale(1.1) rotate(5deg);
}

.pixel-achievement:hover::after {
  opacity: 1;
  animation: rotateBorder 2s linear infinite;
}

@keyframes rotateBorder {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 8-bit Loading Animation */
.pixel-loading {
  display: flex;
  gap: 8px;
}

.pixel-loading-block {
  width: 16px;
  height: 16px;
  background: var(--neon-green);
  animation: pixelBounce 1s infinite ease-in-out;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
}

.pixel-loading-block:nth-child(1) { animation-delay: 0s; }
.pixel-loading-block:nth-child(2) { animation-delay: 0.1s; }
.pixel-loading-block:nth-child(3) { animation-delay: 0.2s; }
.pixel-loading-block:nth-child(4) { animation-delay: 0.3s; }

@keyframes pixelBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-20px); }
}

/* Pixel Heart Animation */
.pixel-heart {
  display: inline-block;
  position: relative;
  width: 32px;
  height: 32px;
  background: var(--neon-pink);
  transform: rotate(-45deg);
  animation: heartBeat 1.5s ease-in-out infinite;
}

.pixel-heart::before,
.pixel-heart::after {
  content: '';
  position: absolute;
  width: 32px;
  height: 32px;
  background: var(--neon-pink);
}

.pixel-heart::before {
  top: -16px;
  left: 0;
}

.pixel-heart::after {
  top: 0;
  left: 16px;
}

@keyframes heartBeat {
  0%, 100% { transform: rotate(-45deg) scale(1); }
  10%, 30% { transform: rotate(-45deg) scale(1.1); }
  20%, 40% { transform: rotate(-45deg) scale(1); }
}

/* Retro HP Bar */
.retro-hp-bar {
  height: 24px;
  background: var(--bg-tertiary);
  border: 2px solid var(--neon-green);
  position: relative;
  overflow: hidden;
  font-family: 'Press Start 2P', cursive;
  font-size: 0.6rem;
}

.retro-hp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg,
    var(--neon-green) 0%,
    var(--neon-yellow) 50%,
    var(--neon-green) 100%
  );
  transition: width 0.5s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #000;
  font-weight: bold;
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.5);
}

/* Coin Flip Animation */
.pixel-coin {
  width: 40px;
  height: 40px;
  background: var(--neon-yellow);
  border-radius: 50%;
  position: relative;
  animation: coinFlip 2s ease-in-out infinite;
  box-shadow:
    0 0 20px var(--neon-yellow),
    inset 0 0 10px rgba(0, 0, 0, 0.3);
}

.pixel-coin::before {
  content: '¢';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Press Start 2P', cursive;
  font-size: 1.5rem;
  color: #000;
  font-weight: bold;
}

@keyframes coinFlip {
  0%, 100% { transform: rotateY(0deg); }
  50% { transform: rotateY(180deg); }
}

/* Retro Dialog Box */
.retro-dialog {
  background: var(--bg-card);
  border: 4px solid var(--neon-green);
  padding: 20px;
  position: relative;
  font-family: 'VT323', monospace;
  font-size: 1.2rem;
}

.retro-dialog::before {
  content: '▶';
  position: absolute;
  bottom: 10px;
  right: 10px;
  color: var(--neon-green);
  animation: blink 1s step-end infinite;
}

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

/* Pixel Particle Effects */
.pixel-particles {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
}

.pixel-particle {
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--neon-green);
  opacity: 0;
  animation: particleFloat 2s ease-out forwards;
}

@keyframes particleFloat {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-100px) scale(0);
  }
}

/* Language Toggle Switch */
.lang-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-tertiary);
  padding: 4px;
  border-radius: 20px;
  border: 2px solid var(--neon-green);
  font-family: 'Press Start 2P', cursive;
  font-size: 0.6rem;
}

.lang-toggle-option {
  padding: 8px 16px;
  cursor: pointer;
  border-radius: 16px;
  transition: all 0.3s ease;
  color: var(--text-secondary);
}

.lang-toggle-option.active {
  background: var(--neon-green);
  color: #000;
  box-shadow: 0 0 20px var(--neon-green);
}

/* Responsive Enhancements */
@media (max-width: 768px) {
  .pixel-btn {
    font-size: 0.6rem;
    padding: 10px 20px;
  }

  .pixel-font {
    font-size: 0.8rem;
  }

  .retro-dialog {
    font-size: 1rem;
    padding: 15px;
  }
}
