:root {
  --primary: #00ff41;
  --secondary: #ff00ff;
  --background: #0a0a0a;
  --terminal: #121212;
  --text: #f0f0f0;
  --glitch: #ff003c;
}

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

body {
  background-color: var(--background);
  color: var(--text);
  font-family: "Space Mono", monospace;
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
}

.noise {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  opacity: 0.05;
  pointer-events: none;
  z-index: 1000;
}

/* Glitch Text Effect */
.glitch-container {
  display: flex;
  justify-content: center;
  padding: 40px 0;
  position: relative;
  z-index: 1;
}

.glitch {
  font-family: "VT323", monospace;
  font-size: 8rem;
  font-weight: bold;
  text-transform: uppercase;
  position: relative;
  text-shadow: 0.05em 0 0 var(--glitch), -0.05em -0.025em 0 #0ff;
  animation: glitch 725ms infinite;
  color: var(--primary);
}

.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.glitch::before {
  left: 0.05em;
  text-shadow: -0.05em 0 0 #ff00ff;
  animation: glitch 690ms infinite;
  clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
}

.glitch::after {
  left: -0.05em;
  text-shadow: 0.05em 0 0 #00ffff;
  animation: glitch 375ms infinite;
  clip-path: polygon(0 60%, 100% 60%, 100% 100%, 0 100%);
}

@keyframes glitch {
  0% {
    text-shadow: 0.05em 0 0 var(--glitch), -0.05em -0.025em 0 #0ff;
  }
  15% {
    text-shadow: -0.05em -0.025em 0 var(--glitch), 0.025em 0.025em 0 #0ff;
  }
  50% {
    text-shadow: 0.025em 0.05em 0 var(--glitch), 0.05em 0 0 #0ff;
  }
  100% {
    text-shadow: -0.05em 0 0 var(--glitch), -0.025em -0.05em 0 #0ff;
  }
}

/* Emoticons */
.emoticon-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
  margin: 20px 0;
  position: relative;
  z-index: 2;
}

.emoticon {
  font-size: 5rem;
  margin: 20px;
  transform: rotate(0deg);
  transition: transform 0.5s ease;
  animation: float 3s ease-in-out infinite;
  text-shadow: 0 0 10px var(--primary);
}

#emoticon1 {
  animation-delay: 0s;
}
#emoticon2 {
  animation-delay: 0.5s;
}
#emoticon3 {
  animation-delay: 1s;
}
#emoticon4 {
  animation-delay: 1.5s;
}
#emoticon5 {
  animation-delay: 2s;
}

@keyframes float {
  0% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-20px) rotate(5deg);
  }
  100% {
    transform: translateY(0) rotate(0deg);
  }
}

/* Terminal */
.terminal {
  width: 80%;
  max-width: 800px;
  margin: 40px auto;
  background-color: var(--terminal);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 0 20px rgba(0, 255, 65, 0.3);
  position: relative;
  z-index: 2;
}

.terminal-header {
  background-color: #333;
  padding: 10px;
  display: flex;
  gap: 8px;
}

.terminal-button {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background-color: #ff5f56;
}

.terminal-button:nth-child(2) {
  background-color: #ffbd2e;
}

.terminal-button:nth-child(3) {
  background-color: #27c93f;
}

.terminal-content {
  padding: 20px;
  font-family: "VT323", monospace;
  font-size: 1.5rem;
  color: var(--primary);
  min-height: 200px;
}

.typing-text {
  display: inline-block;
}

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

@keyframes blink {
  from,
  to {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

/* Broken Grid */
.broken-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 20px;
  margin: 40px 20px;
  position: relative;
  z-index: 2;
}

.grid-item {
  background-color: rgba(0, 0, 0, 0.5);
  border: 2px solid var(--primary);
  padding: 20px;
  font-size: 2rem;
  text-align: center;
  transform: skew(var(--skew, 0deg));
  transition: transform 0.3s ease, background-color 0.3s ease;
  animation: glitchBorder 3s infinite;
}

#grid1 {
  --skew: 5deg;
  animation-delay: 0s;
}
#grid2 {
  --skew: -3deg;
  animation-delay: 0.5s;
}
#grid3 {
  --skew: 2deg;
  animation-delay: 1s;
}
#grid4 {
  --skew: -4deg;
  animation-delay: 1.5s;
}
#grid5 {
  --skew: 3deg;
  animation-delay: 2s;
}

@keyframes glitchBorder {
  0% {
    border-color: var(--primary);
  }
  25% {
    border-color: var(--secondary);
  }
  50% {
    border-color: #00ffff;
  }
  75% {
    border-color: var(--glitch);
  }
  100% {
    border-color: var(--primary);
  }
}

/* Floating Elements */
.floating-elements {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.float-element {
  position: absolute;
  font-family: "VT323", monospace;
  font-size: 1.5rem;
  color: var(--primary);
  opacity: 0.5;
  animation: floatAround 20s linear infinite;
}

#float1 {
  top: 10%;
  left: 5%;
  animation-duration: 30s;
}
#float2 {
  top: 30%;
  right: 10%;
  animation-duration: 25s;
  animation-delay: 5s;
}
#float3 {
  bottom: 20%;
  left: 15%;
  animation-duration: 35s;
  animation-delay: 2s;
}
#float4 {
  bottom: 40%;
  right: 20%;
  animation-duration: 28s;
  animation-delay: 7s;
}

@keyframes floatAround {
  0% {
    transform: translate(0, 0) rotate(0deg);
  }
  25% {
    transform: translate(100px, 50px) rotate(90deg);
  }
  50% {
    transform: translate(50px, 100px) rotate(180deg);
  }
  75% {
    transform: translate(-50px, 50px) rotate(270deg);
  }
  100% {
    transform: translate(0, 0) rotate(360deg);
  }
}

/* Glitch Image */
.glitch-image {
  width: 300px;
  height: 300px;
  margin: 40px auto;
  position: relative;
  overflow: hidden;
  z-index: 2;
}

.image-container {
  width: 100%;
  height: 100%;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300' viewBox='0 0 300 300'%3E%3Crect width='300' height='300' fill='%23000'/%3E%3Ctext x='50%25' y='50%25' dominant-baseline='middle' text-anchor='middle' font-family='monospace' font-size='40' fill='%2300ff41'%3En11v0%3C/text%3E%3C/svg%3E")
    center / cover no-repeat;
  position: relative;
}

.image-glitch {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: inherit;
  opacity: 0.8;
}

.image-glitch:nth-child(1) {
  left: -2px;
  background-color: rgba(255, 0, 255, 0.2);
  animation: glitch-anim-1 2s infinite linear alternate-reverse;
}

.image-glitch:nth-child(2) {
  left: 2px;
  background-color: rgba(0, 255, 255, 0.2);
  animation: glitch-anim-2 3s infinite linear alternate-reverse;
}

.image-glitch:nth-child(3) {
  left: 0;
  background-color: rgba(255, 0, 0, 0.2);
  animation: glitch-anim-3 1s infinite linear alternate-reverse;
}

@keyframes glitch-anim-1 {
  0% {
    clip-path: inset(20% 0 40% 0);
  }
  20% {
    clip-path: inset(60% 0 10% 0);
  }
  40% {
    clip-path: inset(40% 0 40% 0);
  }
  60% {
    clip-path: inset(80% 0 5% 0);
  }
  80% {
    clip-path: inset(10% 0 60% 0);
  }
  100% {
    clip-path: inset(30% 0 30% 0);
  }
}

@keyframes glitch-anim-2 {
  0% {
    clip-path: inset(10% 0 60% 0);
  }
  20% {
    clip-path: inset(30% 0 30% 0);
  }
  40% {
    clip-path: inset(50% 0 20% 0);
  }
  60% {
    clip-path: inset(20% 0 40% 0);
  }
  80% {
    clip-path: inset(70% 0 10% 0);
  }
  100% {
    clip-path: inset(40% 0 50% 0);
  }
}

@keyframes glitch-anim-3 {
  0% {
    clip-path: inset(40% 0 40% 0);
  }
  20% {
    clip-path: inset(20% 0 20% 0);
  }
  40% {
    clip-path: inset(60% 0 30% 0);
  }
  60% {
    clip-path: inset(10% 0 50% 0);
  }
  80% {
    clip-path: inset(40% 0 30% 0);
  }
  100% {
    clip-path: inset(50% 0 60% 0);
  }
}

/* Footer */
footer {
  padding: 20px;
  text-align: center;
  margin-top: 40px;
  border-top: 1px solid var(--primary);
  position: relative;
  z-index: 2;
}

.footer-text {
  font-size: 1.2rem;
  margin-bottom: 10px;
}

.footer-emoticon {
  font-size: 2rem;
}

/* Media Queries */
@media (max-width: 768px) {
  .glitch {
    font-size: 4rem;
  }

  .emoticon {
    font-size: 3rem;
  }

  .terminal {
    width: 90%;
  }

  .broken-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }

  .glitch-image {
    width: 200px;
    height: 200px;
  }
}

@media (max-width: 480px) {
  .glitch {
    font-size: 3rem;
  }

  .emoticon {
    font-size: 2.5rem;
  }

  .terminal-content {
    font-size: 1.2rem;
  }

  .grid-item {
    font-size: 1.5rem;
  }
}
