@import url('https://fonts.googleapis.com/css2?family=Space+Mono:ital,wght@0,400;0,700;1,400;1,700&family=Outfit:wght@300;400;600;900&display=swap');

:root {
  --primary-color: #ff003c;
  --secondary-color: #00f3ff;
  --terminal-green: #00ff41;
  --bg-color: #050505;
  --matrix-color: rgba(0, 150, 255, 0.4);
  --audio-intensity: 0;
  --audio-scale: 1;
  --audio-glow: 0px;
}

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

body {
  background-color: var(--bg-color);
  color: white;
  font-family: 'Outfit', sans-serif;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Background Atmosphere */
.background-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none;
  z-index: 1;
  will-change: transform, opacity;
  transition: opacity 2s ease-in-out;
}

/* Intensity Active State */
body.intensity-active .background-overlay {
  animation: pulse-zoom 0.46s infinite cubic-bezier(0.4, 0, 0.2, 1);
  filter: url(#melt);
}

@keyframes pulse-zoom {
  0% { transform: scale(1); }
  30% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.grid {
  position: absolute;
  width: 200%; height: 200%;
  top: -50%; left: -50%;
  background-image: 
    linear-gradient(rgba(0, 243, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 243, 255, 0.05) 1px, transparent 1px);
  background-size: 50px 50px;
  transform: perspective(500px) rotateX(65deg);
  opacity: 0.2;
}

/* Matrix Characters */
.jp-matrix {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(35px, 1fr));
  grid-auto-rows: 35px;
  font-size: 24px;
  color: var(--matrix-color);
  font-family: 'Space Mono', monospace;
  opacity: 0;
  pointer-events: none;
  z-index: 2;
  transition: opacity 1.5s ease-in-out;
}

body.intensity-active .jp-matrix {
  opacity: 0.4;
}

.jp-matrix > span {
  text-align: center;
  text-shadow: 0 0 8px var(--matrix-color);
}

/* Terminal Container */
.container {
  position: relative;
  width: 850px;
  max-width: 95vw;
  background: rgba(10, 10, 10, 0.95);
  border: 1px solid rgba(0, 243, 255, 0.3);
  z-index: 10;
  backdrop-filter: blur(20px);
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.8), 0 0 20px rgba(0, 243, 255, 0.1);
  transform: scale(var(--audio-scale));
  transition: transform 0.05s linear;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.terminal-header {
  background: rgba(255, 255, 255, 0.05);
  padding: 8px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header-title {
  font-family: 'Space Mono', monospace;
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 1px;
}

.header-dots {
  display: flex;
  gap: 6px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  opacity: 0.3;
}
.dot.red { background: #ff5f56; }
.dot.yellow { background: #ffbd2e; }
.dot.green { background: #27c93f; }

.terminal-body {
  padding: 2.5rem;
  flex-grow: 1;
  position: relative;
}

.terminal-body::after {
  content: "";
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: linear-gradient(
    rgba(18, 16, 16, 0) 50%,
    rgba(0, 0, 0, 0.05) 50%
  ), linear-gradient(
    90deg,
    rgba(255, 0, 0, 0.02),
    rgba(0, 255, 0, 0.01),
    rgba(0, 0, 255, 0.02)
  );
  background-size: 100% 2px, 3px 100%;
  pointer-events: none;
  z-index: 5;
}


.glitch-shake {
  animation: shake 0.2s infinite;
}

@keyframes shake {
  0% { transform: translate(0,0) scale(var(--audio-scale)); }
  33% { transform: translate(-3px, 2px) scale(var(--audio-scale)); }
  66% { transform: translate(3px, -2px) scale(var(--audio-scale)); }
}

/* Logo and Text */
.logo-ascii {
  font-family: 'Space Mono', monospace;
  font-size: 8px;
  line-height: 1.1;
  color: #fff;
  white-space: pre;
  margin-bottom: 1.5rem;
  text-align: center;
  display: block;
  text-shadow: 0 0 10px rgba(255,255,255,0.3);
  opacity: calc(0.7 + var(--audio-intensity) * 0.3);
  overflow: visible;
}

.status-text {
  color: var(--primary-color);
  font-family: 'Space Mono', monospace;
  font-size: 0.85rem;
  letter-spacing: 0.4rem;
  margin-bottom: 2rem;
  text-align: center;
  font-weight: bold;
  text-transform: uppercase;
  animation: pulse-red 2s infinite ease-in-out;
}

@keyframes pulse-red {
  0%, 100% { opacity: 1; text-shadow: 0 0 10px rgba(255,0,60,0.5); }
  50% { opacity: 0.5; text-shadow: 0 0 20px rgba(255,0,60,0.8); }
}

.terminal-logs {
  height: 200px;
  overflow-y: auto;
  font-family: 'Space Mono', monospace;
  margin-bottom: 2rem;
  padding-right: 10px;
}

/* Custom Scrollbar for Terminal */
.terminal-logs::-webkit-scrollbar {
  width: 4px;
}
.terminal-logs::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.05);
}
.terminal-logs::-webkit-scrollbar-thumb {
  background: var(--primary-color);
}

.terminal-line {
  color: var(--terminal-green);
  font-size: 0.85rem;
  margin-bottom: 0.4rem;
  opacity: 0.9;
}

/* Buttons */
#reconnect-btn {
  background: transparent;
  border: 1px solid var(--secondary-color);
  color: var(--secondary-color);
  padding: 0.8rem 1.5rem;
  font-family: 'Space Mono', monospace;
  font-size: 0.8rem;
  cursor: pointer;
  letter-spacing: 2px;
  transition: all 0.3s ease;
  display: block;
  margin: 0 auto;
  text-transform: uppercase;
}

#interactive-terminal {
  display: flex;
  flex-direction: column;
}

.input-line {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--secondary-color);
  font-family: 'Space Mono', monospace;
  font-size: 0.85rem;
}

#terminal-input {
  background: transparent;
  border: none;
  color: #fff;
  font-family: 'Space Mono', monospace;
  font-size: 0.85rem;
  flex-grow: 1;
  outline: none;
  caret-color: var(--secondary-color); /* Blinking cursor */
}

/* Custom blinking cursor effect */
.prompt {
  color: var(--secondary-color);
  font-weight: bold;
}


/* HUD Elements */
.hud {
  position: fixed;
  color: rgba(0, 243, 255, 0.4);
  font-family: 'Space Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 1px;
  z-index: 100;
  pointer-events: none;
}

.hud-top-left { top: 30px; left: 30px; text-align: left; }
.hud-top-right { top: 30px; right: 30px; text-align: right; }
.hud-bottom-left { bottom: 30px; left: 30px; text-align: left; }
.hud-bottom-right { bottom: 30px; right: 30px; text-align: right; }

/* Brackets */
.corner-bracket {
  position: fixed;
  width: 40px;
  height: 40px;
  border: 2px solid rgba(0, 243, 255, 0.2);
  z-index: 90;
  pointer-events: none;
}

.corner-bracket.top-left { top: 20px; left: 20px; border-right: 0; border-bottom: 0; }
.corner-bracket.top-right { top: 20px; right: 20px; border-left: 0; border-bottom: 0; }
.corner-bracket.bottom-left { bottom: 20px; left: 20px; border-right: 0; border-top: 0; }
.corner-bracket.bottom-right { bottom: 20px; right: 20px; border-left: 0; border-top: 0; }

/* Skull Watermark */
.skull-watermark {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 700px;
  opacity: 0.08;
  z-index: 0;
  pointer-events: none;
  animation: flicker 8s infinite;
}

.skull-watermark img {
  width: 100%;
  filter: grayscale(1) brightness(1.5) contrast(1.1);
}

@keyframes flicker {
  0%, 100% { opacity: 0.08; }
  5% { opacity: 0.05; }
  10% { opacity: 0.12; }
}

/* Reboot Overlay */
#reboot-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: black;
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: 'Space Mono', monospace;
  transition: opacity 1.5s;
}

.reboot-content { width: 500px; text-align: center; }
.reboot-title { color: var(--primary-color); font-size: 1.2rem; letter-spacing: 5px; margin-bottom: 30px; }
.reboot-loader { width: 100%; height: 2px; background: #222; overflow: hidden; position: relative; margin-bottom: 20px; }
.reboot-progress { position: absolute; height: 100%; background: var(--primary-color); width: 100%; animation: load 5s linear forwards; }
@keyframes load { from { transform: translateX(-100%); } to { transform: translateX(0); } }

.hidden { display: none !important; }
