
:root { color-scheme: dark; }
* { box-sizing: border-box; }
html, body {
  height: 100%;
}
body {
  font-family: 'VT323', 'Courier New', monospace;
  font-size: 1.25rem;
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  align-items: center;
  justify-content: center;
  background: #000;
  color: #00ff41;
  padding: 1.5rem;
  position: relative;
  overflow-x: hidden;
}
@media (max-width: 480px) {
  body {
    align-items: flex-start;
    padding-top: 2.5rem;
    padding-bottom: 2.5rem;
  }
}
#matrix-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0.55;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 255, 65, 0.05) 0px,
    rgba(0, 255, 65, 0.05) 1px,
    transparent 2px,
    transparent 4px
  );
}
.card {
  position: relative;
  z-index: 1;
  max-width: 34rem;
  width: 100%;
  background: rgba(0, 8, 0, 0.88);
  border: 2px solid #00ff41;
  border-radius: 0.25rem;
  padding: 2rem;
  box-shadow: 0 0 25px rgba(0, 255, 65, 0.35), inset 0 0 15px rgba(0, 255, 65, 0.08);
}
h1 {
  font-family: 'Press Start 2P', monospace;
  font-size: 1rem;
  line-height: 1.6;
  margin: 0.5rem 0 1rem;
  color: #00ff41;
  text-shadow: 0 0 8px rgba(0, 255, 65, 0.8);
}
.ascii {
  color: #00ff41;
  text-shadow: 0 0 6px rgba(0, 255, 65, 0.7);
  font-size: 0.7rem;
  line-height: 1.1;
  margin: 0 0 1rem;
  overflow-x: auto;
}
.meta {
  color: #0aa62f;
  font-size: 0.95rem;
  margin: 0 0 0.5rem;
}
.terminal-log {
  border-left: 2px solid #0aa62f;
  padding-left: 0.8rem;
  margin: 1rem 0;
}
.terminal-log p { margin: 0 0 0.7rem; line-height: 1.4; }
.cursor { animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.puzzle-body { line-height: 1.5; margin-bottom: 0.5rem; }
form { display: flex; gap: 0.5rem; margin-top: 1.5rem; flex-wrap: wrap; }
input[type="text"] {
  flex: 1;
  min-width: 10rem;
  padding: 0.5rem 0.7rem;
  border-radius: 0.2rem;
  border: 1px solid #00ff41;
  background: #000;
  color: #00ff41;
  font-family: inherit;
  font-size: 1.1rem;
}
input[type="text"]:focus { outline: none; box-shadow: 0 0 8px rgba(0, 255, 65, 0.7); }
button {
  padding: 0.5rem 1.1rem;
  border-radius: 0.2rem;
  border: 1px solid #00ff41;
  background: transparent;
  color: #00ff41;
  font-family: inherit;
  font-size: 1.1rem;
  cursor: pointer;
}
button:hover { background: #00ff41; color: #000; }
.error { color: #ff3b3b; text-shadow: 0 0 6px rgba(255, 59, 59, 0.7); margin-top: 0.75rem; }
a { color: #00ff41; }
.hal-card { border-color: #ff3b3b; box-shadow: 0 0 25px rgba(255, 59, 59, 0.4), inset 0 0 15px rgba(255, 59, 59, 0.1); }
.ascii-red { color: #ff3b3b; text-shadow: 0 0 6px rgba(255, 59, 59, 0.8); }
.hal-log { border-left-color: #ff3b3b; }
.glitch {
  color: #ff3b3b;
  text-shadow: 0 0 8px rgba(255, 59, 59, 0.9);
  animation: glitch 2.5s infinite;
}
@keyframes glitch {
  0%, 92%, 100% { transform: translate(0, 0); text-shadow: 0 0 8px rgba(255, 59, 59, 0.9); }
  93% { transform: translate(-2px, 1px); text-shadow: 2px 0 #00ff41, -2px 0 #ff3b3b; }
  95% { transform: translate(2px, -1px); text-shadow: -2px 0 #00ff41, 2px 0 #ff3b3b; }
  97% { transform: translate(0, 0); text-shadow: 0 0 8px rgba(255, 59, 59, 0.9); }
}
.hal-card button { border-color: #ff3b3b; color: #ff3b3b; }
.hal-card button:hover { background: #ff3b3b; color: #000; }
.circuit-diagram { font-size: 0.85rem; margin: 1rem 0; }
.switches { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1rem 0; }
.switch { min-width: 5.5rem; }
.switch-on { background: #00ff41; color: #000; }
#try-code-btn { display: block; margin-top: 0.5rem; }
.cable-diagram { font-size: 1.1rem; margin: 1.5rem 0; white-space: pre; }
.cable-diagram .obstacle { color: #ff3b3b; text-shadow: 0 0 6px rgba(255, 59, 59, 0.8); }
.cable-diagram .obstacle.open { color: #00ff41; text-shadow: 0 0 8px rgba(0, 255, 65, 0.9); }
#cable-status.connected { color: #00ff41; text-shadow: 0 0 8px rgba(0, 255, 65, 0.8); }
#cable-btn { display: block; margin-top: 0.5rem; }
.adder-diagram { font-size: 0.95rem; margin: 1rem 0; }
#music-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 3;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.55rem;
  line-height: 1.4;
  padding: 0.5rem 0.6rem;
}
