:root {
  --crt-red: rgb(218, 49, 49);
  --crt-green: rgb(112, 159, 115);
  --crt-blue: rgb(40, 129, 206);
}

/* Global */
html {
  font-size: 1.5rem;
  font-family: "Courier New", monospace;
  min-height: 100%;
}

body {
  margin: 0;
  background-color: rgb(25, 25, 30);
  height: 100vh;
  /* Force body height */
  overflow: hidden;
  /* Prevent scrolling */
}

* {
  box-sizing: border-box;
  /* Include padding in height/width calculations */
}

main {
  height: 100vh;
  /* Fixed height instead of min-height */
  height: 100dvh;
  /* Mobile viewport support */
  width: 100%;
  color: rgba(255, 255, 255, 0.75);
  display: flex;
  /* Changed from grid to flex column */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  padding-bottom: 5rem;
  /* Turn visual center up to account for footer */
  position: relative;
  /* Ensure it stays within bounds */
}

/* Link Resets */
a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Logo */
.logo {
  max-width: 300px;
  width: 60%;
  /* Responsive width */
  height: auto;
  margin-bottom: 2rem;
  animation: fadeIn 2s ease-out;
  /* Logo appears immediately or fades in */
  filter: drop-shadow(0 0 0.2rem rgba(255, 255, 255, 0.75)) drop-shadow(1px 1px 0 rgba(255, 0, 255, 0.5)) drop-shadow(-1px -1px 0 rgba(0, 255, 255, 0.4));
}

/* Typography Colors */
.pink {
  color: pink;
}

.yellow {
  color: yellow;
}

.lightblue {
  color: lightblue;
}

.code {
  color: attr(data-color);
}

/* Main Typewriter Wrapper */
.wrapper {
  display: inline-block;
  /* Reverted to inline-block for correct width calc */
  max-width: 100%;
  /* Prevent overflow */
  text-align: center;
  white-space: nowrap;
  font-size: 0.9rem;
  /* Smaller for mobile */
  /* overflow: hidden; Removed to allow cursor visibility */
  touch-action: none;
  /* Disable touch gestures like scrolling */
  pointer-events: none;
  /* Disable all pointer events */
}

@media (min-width: 768px) {
  .wrapper {
    font-size: 1.5rem;
  }
}

.code {
  animation: typewriter 2s steps(20) 1s 1 normal both;
  line-height: 1;
  margin: 0;
  display: inline-block;
  white-space: nowrap;
  overflow-x: hidden;
}

.cursor {
  display: inline-block;
}

.main-cursor {
  /* Blink 4 times (4 seconds total), ending at opacity 0 */
  animation: blinkTextCursor 1s 4 alternate forwards;
}

.secondary-cursor {
  opacity: 0;
  /* Hidden initially */
  animation: blinkTextCursor 1s infinite normal 4s;
  /* Start blinking after 4s */
}

/* Sequenced Elements */
/* Sequenced Elements */
.loading-text {
  margin-top: 1.5rem;
  font-size: 0.7rem;
  /* Smaller for mobile */
  white-space: nowrap;
  /* Keep cursor on same line */
  display: inline-block;
  /* Reverted to inline-block */
  max-width: 100%;
  text-align: center;
  /* overflow: hidden; Removed to allow cursor visibility */
  touch-action: none;
  pointer-events: none;
}

@media (min-width: 768px) {
  .loading-text {
    font-size: 1rem;
  }
}

.code-delayed {
  animation: typewriter 2s steps(22) 4s 1 normal both;
  line-height: 1;
  margin: 0;
  display: inline-block;
  white-space: nowrap;
  overflow-x: hidden;
  color: inherit;
  /* Ensure it inherits color */
}

.social-links {
  margin-top: 2rem;
  display: flex;
  gap: 1.5rem;
  font-size: 2rem;
  opacity: 0;
  animation: fadeIn 2s forwards 7s;
  /* appear after loading text */
}

.social-links a {
  transition: transform 0.2s, color 0.2s;
}

.social-links a:hover {
  transform: scale(1.1);
  color: var(--crt-green);
  text-shadow: 0 0 8px var(--crt-green);
  text-decoration: none;
}

/* Footer */
footer {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  box-sizing: border-box;
  /* Ensure padding doesn't overflow */
  display: flex;
  justify-content: space-between;
  padding: 1rem;
  /* Reduced padding for mobile */
  font-size: 0.8rem;
  opacity: 0.6;
  z-index: 10;
  white-space: nowrap;
  /* Prevent line breaks */
}

/* Animations */
@keyframes typewriter {
  from {
    width: 0;
  }

  to {
    width: 100%;
  }
}

@keyframes blinkTextCursor {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes hideCursor {
  to {
    visibility: hidden;
    opacity: 0;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* CRT Effect */
.crt {
  background-color: rgb(25, 25, 30);
  text-shadow: 0 0 0.2em currentColor, 1px 1px rgba(255, 0, 255, 0.5), -1px -1px rgba(0, 255, 255, 0.4);
  position: relative;
}

.crt:before,
.crt:after {
  content: "";
  transform: translateZ(0);
  pointer-events: none;
  mix-blend-mode: overlay;
  position: absolute;
  height: 100%;
  width: 100%;
  left: 0;
  top: 0;
  z-index: 1;
}

.crt:before {
  background: repeating-linear-gradient(var(--crt-red) 0px, var(--crt-green) 2px, var(--crt-blue) 4px);
}

.crt:after {
  background: repeating-linear-gradient(90deg, var(--crt-red) 1px, var(--crt-green) 2px, var(--crt-blue) 3px);
}