body {
  background: #000;
}

#sky {
  display: none;
}

#pato-3d {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 8;
  pointer-events: none;
}

#matrix-rain {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 4;
  pointer-events: none;
}

#error-msg {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: #000;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #ff0060;
  font-family: Helvetica, Arial, sans-serif;
  font-size: 16px;
  text-align: center;
  padding: 20px;
}

#error-msg a {
  color: #ffcc00;
  margin-top: 12px;
}

.nerv-frame {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
}

.nerv-frame::before,
.nerv-frame::after {
  content: '';
  position: absolute;
  border: 2px solid #ff3300;
}

.nerv-frame::before {
  top: 70px;
  left: 8px;
  right: 8px;
  bottom: 8px;
  clip-path: polygon(
    0 20px, 20px 0, calc(100% - 20px) 0, 100% 20px,
    100% calc(100% - 20px), calc(100% - 20px) 100%, 20px 100%, 0 calc(100% - 20px)
  );
  border: none;
  background: linear-gradient(135deg, #ff3300 0%, transparent 5%, transparent 95%, #ff3300 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  padding: 2px;
}

.nerv-frame .corner {
  position: absolute;
  width: 30px;
  height: 30px;
  border-color: #ff3300;
  border-style: solid;
}

.nerv-frame .corner-tl {
  top: 70px;
  left: 8px;
  border-width: 3px 0 0 3px;
}

.nerv-frame .corner-tr {
  top: 70px;
  right: 8px;
  border-width: 3px 3px 0 0;
}

.nerv-frame .corner-bl {
  bottom: 8px;
  left: 8px;
  border-width: 0 0 3px 3px;
}

.nerv-frame .corner-br {
  bottom: 8px;
  right: 8px;
  border-width: 0 3px 3px 0;
}

#nerv-clock {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 50;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  color: #ff6600;
  background: rgba(0, 0, 0, 0.8);
  padding: 8px 12px;
  border: 1px solid #ff3300;
  border-radius: 2px;
  text-align: right;
  line-height: 1.5;
}

#nerv-clock .clock-label {
  font-size: 10px;
  color: #ff3300;
  letter-spacing: 2px;
}

#nerv-status {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: #ff6600;
  background: rgba(0, 0, 0, 0.8);
  padding: 6px 20px;
  border: 1px solid #ff3300;
  border-radius: 2px;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

#nerv-status .status-bar {
  width: 150px;
  height: 8px;
  background: rgba(255, 51, 0, 0.2);
  border: 1px solid #ff3300;
  position: relative;
  overflow: hidden;
}

#nerv-status .status-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff3300, #ff6600);
  width: 0%;
  transition: width 2s ease;
}

#nerv-status.blink {
  animation: nervBlink 1s infinite;
}

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

#nerv-rings {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9;
  pointer-events: none;
}

#nerv-rings .ring {
  position: absolute;
  border: 1px solid rgba(255, 51, 0, 0.15);
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: ringPulse 4s ease-in-out infinite;
}

#nerv-rings .ring:nth-child(1) { width: 200px; height: 200px; animation-delay: 0s; }
#nerv-rings .ring:nth-child(2) { width: 300px; height: 300px; animation-delay: 0.5s; }
#nerv-rings .ring:nth-child(3) { width: 400px; height: 400px; animation-delay: 1s; }
#nerv-rings .ring:nth-child(4) { width: 500px; height: 500px; animation-delay: 1.5s; }

#nerv-rings .ring {
  will-change: opacity, transform;
}

.ecg-path {
  will-change: stroke-dashoffset;
}

@keyframes ringPulse {
  0%, 100% { opacity: 0.3; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 0.6; transform: translate(-50%, -50%) scale(1.02); }
}

#nerv-left-bars {
  position: fixed;
  top: 80px;
  left: 15px;
  z-index: 55;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.left-bar-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Courier New', monospace;
  font-size: 10px;
  color: #ff6600;
  background: rgba(0, 0, 0, 0.8);
  padding: 5px 10px;
  border: 1px solid #ff6600;
  border-radius: 2px;
}

.left-bar-item .bar-label {
  width: 70px;
  color: #ff6600;
  letter-spacing: 1px;
  font-size: 9px;
}

.left-bar-item .status-bar {
  width: 60px;
  height: 6px;
  background: rgba(255, 102, 0, 0.2);
  border: 1px solid #ff6600;
  position: relative;
  overflow: hidden;
}

.left-bar-item .status-fill {
  height: 100%;
  background: #ff6600;
}

.left-bar-item .bar-value {
  width: 50px;
  text-align: right;
  color: #ff6600;
  font-size: 10px;
}

#nerv-wave {
  position: fixed;
  top: 430px;
  left: 15px;
  width: 200px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid #ff6600;
  border-radius: 2px;
}

.ecg-line {
  width: 100%;
  height: 18px;
  overflow: hidden;
}

.ecg-line svg {
  width: 100%;
  height: 100%;
}

.ecg-path {
  fill: none;
  stroke: #ff6600;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-dasharray: 800;
  stroke-dashoffset: 800;
}

.ecg-line:nth-child(1) .ecg-path {
  animation: ecgDraw 3s linear infinite;
}

.ecg-line:nth-child(2) .ecg-path {
  animation: ecgDraw 3s linear infinite;
  animation-delay: 0.4s;
  opacity: 0.7;
}

.ecg-line:nth-child(3) .ecg-path {
  animation: ecgDraw 3s linear infinite;
  animation-delay: 0.8s;
  opacity: 0.4;
}

@keyframes ecgDraw {
  0% { stroke-dashoffset: 800; }
  100% { stroke-dashoffset: 0; }
}

#nerv-vertical-bars {
  position: fixed;
  top: 280px;
  left: 15px;
  z-index: 50;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

@media (min-width: 1024px) and (max-width: 1200px) {
  #nerv-left-bars {
    left: 8px;
  }

  #nerv-left-bars .left-bar-item {
    padding: 4px 8px;
    font-size: 9px;
  }

  #nerv-left-bars .left-bar-item .bar-label {
    width: 50px;
    font-size: 8px;
  }

  #nerv-left-bars .left-bar-item .status-bar {
    width: 40px;
  }

  #nerv-left-bars .left-bar-item .bar-value {
    width: 35px;
    font-size: 8px;
  }

  #nerv-vertical-bars {
    left: 8px;
    top: 240px;
  }

  #nerv-vertical-bars .v-bar-track {
    height: 70px;
  }

  #nerv-wave {
    display: none;
  }

  #code-text {
    top: 50%;
    right: 5%;
    max-width: 40%;
    font-size: 13px;
    padding: 12px;
  }

  #nerv-clock {
    top: 60px;
    right: 10px;
    font-size: 11px;
    padding: 6px 8px;
  }

  #nerv-rings .ring:nth-child(1) { width: 140px; height: 140px; }
  #nerv-rings .ring:nth-child(2) { width: 210px; height: 210px; }
  #nerv-rings .ring:nth-child(3) { width: 280px; height: 280px; }
  #nerv-rings .ring:nth-child(4) { width: 350px; height: 350px; }
}

.v-bar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.v-bar-track {
  width: 12px;
  height: 100px;
  background: rgba(255, 102, 0, 0.15);
  border: 1px solid #ff6600;
  position: relative;
  overflow: hidden;
}

.v-bar-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: #ff6600;
}

.v-bar-label {
  font-family: 'Courier New', monospace;
  font-size: 8px;
  color: #ff6600;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  letter-spacing: 1px;
}

.v-bar-value {
  font-family: 'Courier New', monospace;
  font-size: 9px;
  color: #ff6600;
}

#code-text {
  position: fixed;
  top: 55%;
  right: 9%;
  transform: translateY(-50%);
  z-index: 15;
  font-family: monospace;
  font-size: 15px;
  color: #ff00d4;
  background: rgba(0, 0, 0, 0.7);
  padding: 15px;
  border-radius: 5px;
  max-width: 35%;
  max-height: 70vh;
  overflow-y: auto;
  overflow-x: hidden;
  line-height: 1;
  scrollbar-width: thin;
  scrollbar-color: #ff0060 #1a1a2e;
}

#code-text::-webkit-scrollbar {
  width: 8px;
}

#code-text::-webkit-scrollbar-track {
  background: #1a1a2e;
  border-radius: 4px;
}

#code-text::-webkit-scrollbar-thumb {
  background: #ff0060;
  border-radius: 4px;
}

.highlight {
  color: #FFD700;
  text-decoration: underline;
  text-decoration-color: #FFD700;
  font-weight: bold;
}

.highlight:hover {
  color: #fff;
  text-decoration-color: #fff;
  cursor: pointer;
}

/* RESPONSIVE */
@media (max-width: 480px) {
  body {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  #nerv-clock,
  #nerv-status,
  .nerv-frame {
    display: none;
  }
}

@media (max-width: 700px) {
  #nerv-left-bars,
  #nerv-vertical-bars,
  #nerv-wave {
    display: none;
  }

  #nerv-clock {
    top: 10px;
    right: 10px;
    font-size: 11px;
    padding: 6px 10px;
  }

  #nerv-clock .clock-label {
    font-size: 8px;
  }

  #code-text {
    position: relative;
    top: auto;
    right: auto;
    transform: none;
    max-width: 90%;
    margin: 80px auto 40px;
    font-size: 13px;
    max-height: none;
    overflow-y: visible;
  }

  #nerv-status {
    bottom: 10px;
    font-size: 10px;
    padding: 4px 12px;
    gap: 6px;
  }

  #nerv-status .status-bar {
    width: 100px;
    height: 6px;
  }

  #nerv-rings .ring:nth-child(1) { width: 120px; height: 120px; }
  #nerv-rings .ring:nth-child(2) { width: 180px; height: 180px; }
  #nerv-rings .ring:nth-child(3) { width: 240px; height: 240px; }
  #nerv-rings .ring:nth-child(4) { width: 300px; height: 300px; }

  .nerv-frame .corner {
    width: 20px;
    height: 20px;
  }

  .nerv-frame::before {
    top: 50px;
    left: 5px;
    right: 5px;
    bottom: 5px;
  }

  .nerv-frame .corner-tl { top: 50px; left: 5px; }
  .nerv-frame .corner-tr { top: 50px; right: 5px; }
  .nerv-frame .corner-bl { bottom: 5px; left: 5px; }
  .nerv-frame .corner-br { bottom: 5px; right: 5px; }
}
