/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ✅ Page Layout */
body {
  background-color: #1a0000;
  color: white;
  font-family: 'Courier New', monospace;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 100vh;
  margin: 0;
  padding: 2rem;
}

/* ✅ Header: centered & vertical */
.header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 1rem;
}

.hcs-logo {
  height: 64px;
  width: auto;
  margin-bottom: 0.5rem;
  image-rendering: crisp-edges;
}

.terminal-title {
  font-size: 1.2rem;
  color: red;
  letter-spacing: 0.15rem; /* Slightly more spacing to balance the dots */
  text-transform: uppercase;
  text-align: center;
  font-weight: normal;
}

/* ✅ Terminal Box */
.terminal {
  width: 90%;
  max-width: 960px;
  background-color: #1a0000;
  border: 1px solid #333;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  height: 500px;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 0 0 10px red;
}

/* ✅ Scrollable Output */
.output {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  margin-bottom: 1rem;
  padding-right: 4px;
  scrollbar-color: red transparent;
  scrollbar-width: thin;
  word-wrap: break-word;
  word-break: break-word;
  white-space: pre-wrap;
}

.output::-webkit-scrollbar {
  width: 8px;
}
.output::-webkit-scrollbar-thumb {
  background-color: red;
  border-radius: 4px;
}
.output::-webkit-scrollbar-track {
  background-color: transparent;
}

/* ✅ Boot Screen Overlay */
.boot-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #0a0000; /* Darker red-black blend */
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: bootFade 2.5s forwards;
}

.boot-text {
  color: red;
  font-size: 1.2rem;
  font-family: 'Courier New', monospace;
  letter-spacing: 0.1rem;
  text-transform: uppercase;
  opacity: 0.9;
}

@keyframes bootFade {
  0%   { opacity: 1; }
  100% { opacity: 0; visibility: hidden; }
}

.message {
    margin-bottom: 5px; /* Small space between messages */
}

@keyframes glitch {
    0% {
      text-shadow: 2px 0 red, -2px 0 blue;
    }
    20% {
      text-shadow: -2px 0 red, 2px 0 blue;
    }
    40% {
      text-shadow: 2px 0 blue, -2px 0 red;
    }
    60% {
      text-shadow: -2px 0 blue, 2px 0 red;
    }
    80% {
      text-shadow: 2px 0 red, -2px 0 blue;
    }
    100% {
      text-shadow: 0 0 red, 0 0 blue;
    }
}
  
.glitch {
  animation: glitch 250ms infinite;
  color: #fff;
  text-shadow:
    0 0 2px #fff,
    0 0 5px #f0f,
    0 0 10px #0ff,
    2px 0 red,
    -2px 0 blue;
}

.ambient-corner {
  position: fixed;
  top: 8px;
  padding: 6px 10px;
  background-color: rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(0, 255, 0, 0.05);
  border-radius: 6px;
  font-family: 'Courier New', monospace;
  font-size: 0.75rem;
  color: rgba(0, 255, 0, 0.25);
  pointer-events: none;
  z-index: 2;
  max-width: 250px;
}

.ambient-left {
  left: 10px;
  text-align: left;
}

.ambient-right {
  right: 10px;
  text-align: right;
}

.ambient-line {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.input {
    border: none;
    padding: 10px;
    background-color: transparent;  /* No background, to remove inner box */
    color: white;
    font-size: 16px;
    width: 100%;
    outline: none;
    border-radius: 8px; /* Rounded edges for the input */
    height: 30px;  /* Short input box */
    font-family: 'Lucida Console', Monaco, monospace; /* Lucida Console font */
}

/* Add red color for terminal messages and white for user messages */
.terminal-message {
    color: red;
}

.user-message {
    color: white;
}

/* Remove placeholder text */
.input::placeholder {
    color: transparent;
}

body.green-mode {
  background-color: #002b00;
  color: #00ff7f;
  font-family: 'Courier New', monospace;
}

.green-mode .terminal {
  background-color: transparent;
  box-shadow: 0 0 20px #00ff7f;
  border: 1px solid #00ff7f;
}

.green-mode .terminal-title {
  display: none; /* hide old HCS text */
}

@keyframes glitchIn {
  0% {
    opacity: 0;
    transform: translateX(-50%) scale(0.95) skewX(8deg);
    filter: hue-rotate(90deg) brightness(1.8);
  }
  20% {
    transform: translateX(-50%) scale(1.03) skewX(-6deg);
  }
  40% {
    transform: translateX(-50%) scale(0.98) skewX(4deg);
  }
  60% {
    transform: translateX(-50%) scale(1.01) skewX(-2deg);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) scale(1) skewX(0deg);
    filter: none;
  }
}

@keyframes glitchOut {
  0% {
    opacity: 1;
    transform: translateX(-50%) scale(1) skewX(0deg);
  }
  25% {
    transform: translateX(-50%) scale(1.02) skewX(-4deg);
  }
  50% {
    transform: translateX(-50%) scale(0.98) skewX(6deg);
  }
  75% {
    transform: translateX(-50%) scale(1.03) skewX(-2deg);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) scale(0.95) skewX(8deg);
    filter: hue-rotate(120deg) brightness(2);
  }
}

.green-header {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 2rem;
  position: relative;
  z-index: 2;
}

.green-mask {
  height: 160px; /* was 100px */
  width: auto;
}

.green-input-container {
  display: flex;
  justify-content: center;
  margin-top: 4rem; /* was 2rem */
}

.green-input {
  background-color: transparent;
  border: 2px solid #00FF7F;
  color: #00FF7F;
  font-size: 1.1rem;
  padding: 12px 16px;
  font-family: 'Courier New', monospace;
  width: 400px;
  border-radius: 0;
  outline: none;
}

.green-dialogue-box {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%); /* ✅ always centered */
  background-color: rgba(0, 50, 0, 0.9);
  border: 2px solid #00FF7F;
  color: #00FF7F;
  font-family: 'Courier New', monospace;
  padding: 1.2rem 1.5rem;
  width: 600px;
  max-width: 90%;
  opacity: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: none; /* ✅ NO smoothing! */
  pointer-events: auto;
  z-index: 999;
}

.green-dialogue-box .dialogue-content {
    white-space: pre-wrap;
}

.green-dialogue-box.visible {
  opacity: 1;
  animation: glitchIn 0.4s steps(2, end);
}

.green-dialogue-box.hiding {
  animation: glitchOut 0.4s steps(2, end);
  opacity: 0;
  border: none !important;
  box-shadow: none !important;
}

.dialogue-content {
  font-size: 1rem;
  line-height: 1.4;
  word-wrap: break-word;
}

.dialogue-arrow {
  align-self: flex-end;
  font-size: 1.5rem;
  color: #00FF7F;
  animation: pulseArrow 1.2s infinite;
  cursor: pointer;
  user-select: none;
  margin-top: 0.5rem;
  margin-right: 0.2rem;
  line-height: 1;
  z-index: 1;
}

@keyframes pulseArrow {
  0% { opacity: 0.2; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(4px); }
  100% { opacity: 0.2; transform: translateY(0); }
}

.green-static-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1; /* ✅ go behind everything */
  opacity: 0.06;
  pointer-events: none;
  background-color: #001800;
}

.green-static-background img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) brightness(1.2) contrast(1.4) hue-rotate(90deg);
}

/* Glitch transition overlay */
.crt-glitch {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    #ff00ff,
    #ff00ff 1px,
    #000 2px
  );
  animation: crtGlitchAnim 2s ease-out forwards;
  pointer-events: none;
  mix-blend-mode: screen;
}

@keyframes crtGlitchAnim {
  0% {
    opacity: 1;
    transform: scale(1) skew(0deg);
    filter: hue-rotate(0deg) contrast(1.2);
  }
  30% {
    transform: scale(1.02) skewX(5deg);
    filter: hue-rotate(90deg) contrast(2);
  }
  60% {
    transform: scale(0.98) skewY(-4deg);
    filter: hue-rotate(270deg) contrast(1.5);
  }
  100% {
    opacity: 0;
    transform: none;
    filter: none;
  }
}

/* Glitch/shake/text effects */
.glitch-text {
  animation: glitch 250ms infinite;
}
@keyframes glitch {
  0% { text-shadow: 2px 0 red, -2px 0 blue; }
  50% { text-shadow: -2px 0 red, 2px 0 blue; }
  100% { text-shadow: 2px 0 red, -2px 0 blue; }
}

.shake {
  display: inline-block;
  animation: shakeAnim 0.4s infinite;
}
@keyframes shakeAnim {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-1px, 1px); }
  50% { transform: translate(1px, -1px); }
  75% { transform: translate(-1px, 1px); }
  100% { transform: translate(0, 0); }
}

.colored-red { color: red; }
.colored-blue { color: #00f; }
