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

body {
  font-family: "Courier New", monospace;
  overflow: hidden;
  background: #000;
  color: #0f0;
  cursor: crosshair;
}

#hydra-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1;
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2rem;
}

.glitch-container {
  text-align: center;
  margin-top: 2rem;
}

.glitch {
  /* Usando clamp() para que el tamaño del texto se ajuste automáticamente */
  font-size: clamp(2rem, 8vw, 6rem); 
  font-weight: bold;
  text-transform: uppercase;
  position: relative;
  text-shadow: 0.05em 0 0 #f0f, -0.025em -0.05em 0 #0ff, 0.025em 0.05em 0 #ff0;
  animation: glitch 500ms infinite;
  letter-spacing: 0.1em;
}

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

/* ... (Animaciones @keyframes glitch, glitch-anim, glitch-anim2 se mantienen sin cambios) ... */

@keyframes glitch {
  /* ... (código) ... */
}

@keyframes glitch-anim {
  /* ... (código) ... */
}

@keyframes glitch-anim2 {
  /* ... (código) ... */
}


.poem-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  padding: 2rem;
}

.poem-line {
  /* Usando clamp() para responsividad */
  font-size: clamp(1rem, 3vw, 1.8rem); 
  text-align: center;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeInUp 1s forwards;
  text-shadow: 0 0 10px #0f0, 0 0 20px #0f0, 0 0 30px #0f0;
  letter-spacing: 0.05em;
  max-width: 90%;
}

.poem-line:nth-child(1) {
  animation-delay: 0.5s;
}
.poem-line:nth-child(2) {
  animation-delay: 1s;
}
.poem-line:nth-child(3) {
  animation-delay: 1.5s;
}
.poem-line:nth-child(4) {
  animation-delay: 2s;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.info-bar {
  background: rgba(0, 0, 0, 0.8);
  border: 2px solid #0f0;
  padding: 0.5rem 1rem;
  /* Usando clamp() para responsividad */
  font-size: clamp(0.7rem, 2vw, 1rem); 
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  box-shadow: 0 0 20px rgba(0, 255, 0, 0.5);
}

.blink {
  animation: blink 1s infinite;
}

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

.separator {
  color: #0f0;
}

.controls {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  pointer-events: all;
  margin: 1rem 0;
}

.retro-btn {
  background: #000;
  color: #0f0;
  border: 2px solid #0f0;
  padding: 0.75rem 1.5rem;
  font-family: "Courier New", monospace;
  /* Usando clamp() para responsividad */
  font-size: clamp(0.8rem, 2vw, 1rem); 
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  transition: all 0.3s;
  box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
  position: relative;
  overflow: hidden;
}

/* ... (Estilos :hover y :active del botón sin cambios) ... */

.retro-btn:hover {
  background: #0f0;
  color: #000;
  box-shadow: 0 0 20px rgba(0, 255, 0, 0.8);
  transform: scale(1.05);
}

.retro-btn:active {
  transform: scale(0.95);
}

.retro-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: rgba(0, 255, 0, 0.3);
  transition: left 0.3s;
}

.retro-btn:hover::before {
  left: 100%;
}

.instructions {
  background: rgba(0, 0, 0, 0.8);
  border: 2px solid #0f0;
  padding: 1rem;
  /* Usando clamp() para responsividad */
  font-size: clamp(0.7rem, 1.5vw, 0.9rem); 
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  box-shadow: 0 0 20px rgba(0, 255, 0, 0.5);
}

.instructions p {
  margin: 0;
}

.key {
  background: #0f0;
  color: #000;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  font-weight: bold;
}

/* --- Media Queries Generales --- */
@media (max-width: 768px) {
  .overlay {
    padding: 1rem;
  }

  .glitch-container {
    margin-top: 1rem;
  }

  .poem-container {
    padding: 1rem;
    gap: 0.5rem;
  }

  .controls {
    gap: 0.5rem;
  }

  .retro-btn {
    padding: 0.5rem 1rem;
  }

  .instructions {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }

  .info-bar {
    font-size: 0.7rem;
    gap: 0.5rem;
    padding: 0.5rem;
  }
}

@media (max-width: 480px) {
  .overlay {
    padding: 0.5rem;
  }

  .poem-line {
    font-size: 1rem;
  }

  .controls {
    flex-direction: column;
    width: 100%;
  }

  .retro-btn {
    width: 100%;
  }
}

/* --- Estilos para la Ventana Modal (Responsive) --- */

.modal {
  display: none; 
  position: fixed; 
  z-index: 10; 
  left: 0;
  top: 0;
  width: 100%; 
  height: 100%; 
  overflow: auto; 
  background-color: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(5px);
}

.modal-content {
  background-color: #000;
  color: #0f0;
  border: 4px double #0f0;
  box-shadow: 0 0 50px rgba(0, 255, 0, 0.7);
  /* Ajuste: Usar 'vw' y 'vh' para centrar mejor en cualquier dispositivo */
  margin: 5vh auto; 
  padding: 2rem;
  width: 90%; 
  max-width: 700px;
  position: relative;
  font-family: "Courier New", monospace;
  animation: modal-open 0.5s ease-out;
  /* Scrollable en caso de contenido largo */
  max-height: 90vh; 
  overflow-y: auto;
}

@keyframes modal-open {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

.close-btn {
  color: #f00; 
  font-size: 3rem;
  font-weight: bold;
  position: absolute;
  top: 10px;
  right: 25px;
  cursor: pointer;
  text-shadow: 0 0 5px #f00;
  transition: text-shadow 0.3s, color 0.3s;
}

/* Estilo para los títulos y texto de la modal */
.glitch-title {
    /* Usando clamp() para responsividad */
    font-size: clamp(1.5rem, 4vw, 2.5rem); 
    text-transform: uppercase;
    text-shadow: 0.05em 0 0 #f0f, -0.025em -0.05em 0 #0ff, 0.025em 0.05em 0 #ff0;
    margin-bottom: 1.5rem;
}

.modal-subtitle {
    /* Usando rem */
    font-size: 1.4rem; 
    color: #ff0;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    border-bottom: 1px dashed #ff0;
    padding-bottom: 0.2rem;
}

.modal-text, .modal-content ul {
    /* Usando rem */
    font-size: 1rem; 
    line-height: 1.6;
    margin-bottom: 1rem;
    list-style-type: none;
    padding-left: 0;
}

/* ... (Estilos de lista y key-modal sin cambios, ya usan unidades relativas) ... */

.modal-content ul li {
    margin-bottom: 0.5rem;
    padding-left: 1.5em;
    position: relative;
}

.modal-content ul li::before {
    content: ">";
    color: #0f0;
    font-weight: bold;
    display: inline-block;
    width: 1em;
    margin-left: -1em;
}

.interaction-list li::before {
    content: ">>";
    color: #0ff;
}

.highlight {
    color: #0ff;
    font-weight: bold;
}

.key-modal {
    background: #0f0;
    color: #000;
    padding: 0.1rem 0.4rem;
    border-radius: 2px;
    font-weight: bold;
    display: inline-block;
}

/* Media query para hacer el modal más pequeño en móviles */
@media (max-width: 768px) {
    .modal-content {
        /* Ajuste: Usar 'vh' y 'vw' para maximizar espacio */
        margin: 2vh auto; 
        padding: 1.5rem;
        max-width: 95%; /* Asegura que no se pegue a los bordes */
        width: 95%;
        max-height: 96vh;
    }
    .glitch-title {
        /* Se ajusta con clamp() */
        margin-top: 1rem;
    }
    .close-btn {
        font-size: 2rem;
        right: 15px;
    }
    .modal-subtitle {
        font-size: 1.2rem;
    }
    .modal-text, .modal-content ul {
        font-size: 0.9rem;
    }
}