/* Cyber 2000's vibe - MAX animations */
@import url('https://fonts.googleapis.com/css2?family=Coral+Pixels&family=VT323&display=swap');

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

body {
  font-family: 'VT323', monospace;
  background: black;
  color: #ff00ff;
  overflow-x: hidden;
}

/* === Animated background grid === */
body::before {
  content: "";
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, rgba(255,0,255,0.1) 1px, transparent 1px),
              linear-gradient(rgba(0,255,255,0.1) 1px, transparent 1px);
  background-size: 40px 40px;
  z-index: -2;
  animation: movegrid 10s linear infinite;
}

@keyframes movegrid {
  from { background-position: 0 0, 0 0; }
  to   { background-position: 40px 40px, 40px 40px; }
}

/* === CRT Scanline effect === */
body::after {
  content: "";
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255,255,255,0.05),
    rgba(255,255,255,0.05) 1px,
    transparent 2px,
    transparent 3px
  );
  pointer-events: none;
  z-index: -1;
  animation: flicker 0.15s infinite;
}

/* === Container layout === */
.container {
  max-width: 1000px;
  margin: 40px auto;
  text-align: center;
  padding: 20px;
}

/* === Glitchy header === */
header h1 {
  font-size: 4em;
  position: relative;
  display: inline-block;
  color: #ff00ff;
  text-shadow: 0 0 5px #ff00ff, 0 0 10px #ff00ff;
  animation: glitch 2s infinite;
}

header h1::before,
header h1::after {
  content: "/nullmatrix";
  position: absolute;
  left: 0;
  width: 100%;
  overflow: hidden;
  color: #0ff;
  clip: rect(0, 0, 0, 0);
}

header h1::before {
  animation: glitchTop 2s infinite linear alternate-reverse;
}

header h1::after {
  animation: glitchBottom 2s infinite linear alternate-reverse;
}

@keyframes glitch {
  0% { transform: none; }
  20% { transform: skew(5deg); }
  40% { transform: skew(-5deg); }
  60% { transform: none; }
}

@keyframes glitchTop {
  0% { clip: rect(0, 9999px, 0, 0); }
  20% { clip: rect(0, 9999px, 20px, 0); transform: translate(-3px, -3px); }
  40% { clip: rect(0, 9999px, 15px, 0); transform: translate(3px, 3px); }
  60% { clip: rect(0, 9999px, 10px, 0); transform: translate(-2px, 2px); }
  100% { clip: rect(0, 9999px, 0, 0); transform: none; }
}

@keyframes glitchBottom {
  0% { clip: rect(0, 9999px, 0, 0); }
  20% { clip: rect(25px, 9999px, 40px, 0); transform: translate(3px, 3px); }
  40% { clip: rect(15px, 9999px, 30px, 0); transform: translate(-3px, -2px); }
  60% { clip: rect(20px, 9999px, 35px, 0); transform: translate(2px, -3px); }
  100% { clip: rect(0, 9999px, 0, 0); transform: none; }
}

.subtitle {
  font-size: 1.2em;
  color: #0ff;
  text-shadow: 0 0 5px #0ff, 0 0 15px #0ff;
  margin-bottom: 30px;
  animation: flicker 1.5s infinite alternate;
}

/* Flicker */
@keyframes flicker {
  0% { opacity: 1; }
  50% { opacity: 0.6; }
  100% { opacity: 1; }
}

/* === Chatroom styling === */
.chatroom {
  width: 90%;
  max-width: 800px;
  margin: auto;
  border: 2px solid #0ff;
  background: rgba(0, 0, 0, 0.85);
  box-shadow: 0 0 15px #0ff, inset 0 0 10px #ff00ff;
  border-radius: 10px;
  padding: 15px;
  animation: glowpulse 2s infinite alternate;
}

@keyframes glowpulse {
  from { box-shadow: 0 0 10px #ff00ff, inset 0 0 5px #0ff; }
  to   { box-shadow: 0 0 20px #0ff, inset 0 0 15px #ff00ff; }
}

.messages {
  height: 400px;
  overflow-y: auto;
  padding: 10px;
  border: 1px solid #ff00ff;
  background: rgba(20, 20, 20, 0.9);
  margin-bottom: 10px;
  font-size: 0.9em;
  text-align: left;
}

#chat-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

#chat-form input {
  flex: 1;
  padding: 8px;
  background: black;
  color: #0ff;
  border: 2px solid #0ff;
  border-radius: 4px;
  outline: none;
  transition: 0.2s;
}

#chat-form input:focus {
  box-shadow: 0 0 10px #ff00ff;
}

#chat-form button {
  padding: 8px 16px;
  background: #ff00ff;
  border: none;
  color: black;
  font-weight: bold;
  border-radius: 4px;
  cursor: pointer;
  transition: 0.2s;
}

#chat-form button:hover {
  background: #0ff;
  color: black;
}


/* === Grid Layout === */
.grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); 
  gap: 20px;
  padding: 20px;
  width: 90%;
  max-width: 1200px;
  margin: auto;
}

/* Each section styled consistently */
.grid-container section {
  border: 2px solid #0ff;
  background: rgba(0, 0, 0, 0.85);
  box-shadow: 0 0 10px #ff00ff, inset 0 0 5px #0ff;
  border-radius: 10px;
  padding: 15px;
  animation: glowpulse 2s infinite alternate;
}

.grid-container h2 {
  color: #ff00ff;
  margin-bottom: 10px;
  text-shadow: 0 0 5px #ff00ff, 0 0 10px #0ff;
}

/* Animate new messages */
.message {
  padding: 2px 0;
  font-size: 0.95em;
  opacity: 0;
  transform: translateY(10px);
  animation: popIn 0.5s forwards;
  text-shadow: 0 0 2px #0ff, 0 0 5px #ff00ff;
}

@keyframes popIn {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  50% {
    opacity: 1;
    transform: translateY(-2px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

