html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: "Courier New", monospace;
  color: #00ff66;
  -webkit-text-size-adjust: none;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeSpeed
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

@media (max-width: 768px) {
  html,
  body {
    height: auto;
    min-height: 100%;
    overflow-y: auto;
  }
}

canvas {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  background: #000;
  touch-action: none;
  z-index: 0;
}

/* LOGO */
#logo {
  position: fixed;
  top: 1rem;
  left: 1rem;
  width: 120px;
  z-index: 10;
}

@media (max-width: 768px) {
  #logo {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    width: clamp(140px, 40vw, 180px);
    margin: 1rem auto 0.5rem;
    display: block;
    z-index: 12;
  }
}

#boot-loader {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.92);
  color: #00ff66;
  font-family: "Courier New", monospace;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  z-index: 30;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

#boot-loader.boot-loader--hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#boot-loader.boot-loader--error {
  color: #ff6666;
}

.boot-loader-inner {
  background: rgba(0, 20, 0, 0.75);
  border: 1px solid #00ff66;
  box-shadow: 0 0 14px rgba(0, 255, 102, 0.35), inset 0 0 10px rgba(0, 255, 102, 0.2);
  border-radius: 12px;
  padding: 1.6rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: clamp(240px, 50vw, 420px);
  text-align: center;
}

.boot-loader-label {
  margin: 0;
  font-size: clamp(0.7rem, 2vw, 0.9rem);
}

.boot-loader-progress {
  width: 100%;
  height: 7px;
  background: rgba(0, 60, 0, 0.6);
  border: 1px solid rgba(0, 255, 102, 0.4);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 0 6px rgba(0, 255, 102, 0.25);
}

.boot-loader-progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #00ff66, #a8ff9f);
  box-shadow: 0 0 12px rgba(0, 255, 102, 0.5);
  transition: width 0.6s ease;
}

#boot-loader.boot-loader--complete .boot-loader-progress-bar {
  background: linear-gradient(90deg, #66ff99, #a8ff9f);
}

#boot-loader.boot-loader--error .boot-loader-progress-bar {
  background: linear-gradient(90deg, #ff6666, #ff9933);
  box-shadow: 0 0 12px rgba(255, 102, 102, 0.5);
}

.boot-loader-step {
  margin: 0;
  font-size: clamp(0.75rem, 2.2vw, 1rem);
  letter-spacing: 0.08em;
}

.boot-loader-action {
  background: rgba(0, 255, 102, 0.16);
  color: #00ff66;
  border: 1px solid rgba(0, 255, 102, 0.6);
  border-radius: 6px;
  padding: 0.6rem 1.2rem;
  font-family: "Courier New", monospace;
  font-size: clamp(0.7rem, 2vw, 0.95rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.3s ease, color 0.3s ease, border 0.3s ease, box-shadow 0.3s ease;
}

.boot-loader-action:hover,
.boot-loader-action:focus-visible {
  background: rgba(0, 255, 102, 0.35);
  color: #ffffff;
  border-color: rgba(0, 255, 102, 0.85);
  box-shadow: 0 0 12px rgba(0, 255, 102, 0.4);
}

.boot-loader-action:active {
  background: rgba(0, 255, 102, 0.5);
}

.boot-loader-action--secondary {
  background: transparent;
  border-color: rgba(0, 255, 102, 0.35);
  color: #ccffe4;
}

.boot-loader-action--secondary:hover,
.boot-loader-action--secondary:focus-visible {
  background: rgba(0, 50, 0, 0.45);
  color: #ffffff;
}

/* HUD + MODULES */
#hud {
  position: fixed;
  inset: 0;
  z-index: 11;
  pointer-events: none;
  color: #00ff66;
  text-shadow: 0 0 4px #00ff66;
  font-family: "Courier New", monospace;
  transition: opacity 0.8s ease;
}

#hud.dimmed {
  opacity: 0.25;
}

#hud-message {
  position: absolute;
  top: clamp(3.5rem, 6vw, 4.75rem);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 20, 0, 0.6);
  padding: 0.6rem 1.4rem;
  border: 1px solid #00ff66;
  border-radius: 8px;
  box-shadow: 0 0 8px rgba(0, 255, 102, 0.35),
    inset 0 0 8px rgba(0, 255, 102, 0.2);
  min-width: clamp(220px, 40vw, 480px);
  max-width: min(90vw, 540px);
  pointer-events: none;
  text-align: center;
}

#hud-message[hidden] {
  display: none;
}

#hud-message .typewriter span,
#hud-message span {
  display: inline-block;
}

#hud-modules {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

#hud-widgets {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hud-widget {
  position: absolute;
  background: rgba(0, 20, 0, 0.6);
  border: 1px solid #00ff66;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(0, 255, 102, 0.26),
    inset 0 0 8px rgba(0, 255, 102, 0.16);
  padding: 0.7rem 0.8rem;
  color: #00ff66;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 180px;
  max-width: 220px;
  pointer-events: auto;
  z-index: 12;
  opacity: 0.94;
  overflow: hidden;
}

.hud-window {
  position: absolute;
  background: rgba(0, 18, 0, 0.92);
  border: 1px solid #00ff66;
  border-radius: 10px;
  box-shadow: 0 0 14px rgba(0, 255, 102, 0.3), inset 0 0 10px rgba(0, 255, 102, 0.12);
  display: flex;
  flex-direction: column;
  min-width: 240px;
  min-height: 180px;
  pointer-events: auto;
  overflow: hidden;
}

.hud-window-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 0.6rem;
  background: rgba(0, 12, 0, 0.9);
  border-bottom: 1px solid rgba(0, 255, 102, 0.35);
  cursor: move;
  user-select: none;
}

.hud-window-controls {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.hud-window-control {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  background: rgba(0, 255, 102, 0.2);
  border: 1px solid rgba(0, 255, 102, 0.5);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #001a0a;
  font-size: 0.75rem;
  line-height: 0.8rem;
}

.hud-window-control--close {
  background: rgba(0, 255, 102, 0.35);
  border-color: rgba(0, 255, 102, 0.7);
  color: #001a0a;
  cursor: pointer;
}

.hud-window-control--close:hover,
.hud-window-control--close:focus-visible {
  filter: brightness(1.05);
}

.hud-window-heading {
  display: flex;
  flex: 1;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #00ff99;
}

.hud-window-title {
  font-weight: 700;
}

.hud-window-meta {
  font-size: 0.65rem;
  color: rgba(0, 255, 102, 0.65);
}

.hud-window-body {
  flex: 1;
  padding: 0.6rem;
  overflow: auto;
  font-size: 16px;
  line-height: 1.35;
  color: rgba(0, 255, 102, 0.9);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.hud-window-body img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.2rem auto;
  border-radius: 12px;
  filter: grayscale(100%) contrast(1.25) brightness(1.05) sepia(85%) hue-rotate(75deg)
    saturate(220%);
  mix-blend-mode: screen;
}

.hud-window-body hr {
  border: none;
  border-top: 1px solid rgba(0, 255, 102, 0.6);
  margin: 1.4rem 0;
}

.hud-window-body a {
    color: rgba(0, 255, 102, 0.9);
}

.hud-window-resizer {
  position: absolute;
  right: 6px;
  bottom: 6px;
  width: 14px;
  height: 14px;
  border-right: 2px solid rgba(0, 255, 102, 0.6);
  border-bottom: 2px solid rgba(0, 255, 102, 0.6);
  cursor: se-resize;
}

.hud-window.is-fullscreen {
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  border-radius: 0;
}

.hud-widget[data-position="top-left"] {
  top: clamp(2.5rem, 6vw, 3.5rem);
  left: clamp(0.75rem, 4vw, 2.5rem);
}

.hud-widget[data-position="top-right"] {
  top: clamp(2.5rem, 6vw, 3.5rem);
  right: clamp(0.75rem, 4vw, 2.5rem);
}

.hud-widget[data-position="bottom-left"] {
  bottom: clamp(5.5rem, 14vw, 9rem);
  left: clamp(0.75rem, 4vw, 2.5rem);
}

.hud-widget[data-position="bottom-right"] {
  bottom: clamp(5.5rem, 14vw, 9rem);
  right: clamp(0.75rem, 4vw, 2.5rem);
}

.hud-widget[data-position="left"] {
  top: 50%;
  left: clamp(0.75rem, 4vw, 2.5rem);
  transform: translateY(-50%);
}

.hud-widget[data-position="right"] {
  top: 50%;
  right: clamp(0.75rem, 4vw, 2.5rem);
  transform: translateY(-50%);
}

.hud-widget[data-position="center"] {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  min-width: clamp(260px, 36vw, 520px);
  max-width: clamp(320px, 48vw, 620px);
}

@media (max-width: 768px) {
  #hud {
    position: static;
    inset: auto;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 0 1rem clamp(6rem, 22vh, 12rem);
    width: 100%;
    pointer-events: none;
    overflow-x: hidden;
  }
  html,
  body {
    overflow-x: hidden;
  }

  #hud-modules,
  #hud-widgets {
    position: static;
    inset: auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
  }

  .hud-module,
  .hud-widget,
  .hud-window {
    position: static;
    inset: auto;
    transform: none !important;
    width: 100% !important;
    max-width: none;
    min-width: 0;
    margin: 0 auto 0.85rem;
  }

  .hud-module.is-visible,
  .hud-widget,
  .hud-window {
    display: flex;
  }

  #hud-message {
    position: static;
    transform: none;
    left: auto;
    top: auto;
    max-width: 100%;
    min-width: 0;
    margin: 0 auto 0.85rem;
  }
}

.hud-widget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hud-widget-title {
  font-weight: 700;
}

.hud-widget-meta {
  font-size: 0.7rem;
  color: rgba(0, 255, 102, 0.7);
}

.hud-widget-body {
  font-size: 0.78rem;
  line-height: 1.35;
  color: rgba(0, 255, 102, 0.9);
}

.hud-widget-meter {
  width: 100%;
  height: 12px;
  border: 1px solid #00ff66;
  border-radius: 12px;
  padding: 1px;
  background: rgba(0, 255, 102, 0.05);
  overflow: hidden;
}

.hud-widget-meter-fill {
  height: 100%;
  border-radius: 10px;
  background: linear-gradient(90deg, #0aff7d, #39ff14);
  box-shadow: 0 0 12px rgba(0, 255, 102, 0.4);
  transition: width 0.4s ease, filter 0.4s ease;
}

.hud-widget-meter-fill[data-level="low"] {
  background: linear-gradient(90deg, #ff5f52, #ffb347);
  box-shadow: 0 0 10px rgba(255, 128, 82, 0.5);
}

.hud-widget-ticker {
  display: grid;
  gap: 0.2rem;
  overflow: hidden;
}

.hud-widget-ticker-line {
  font-family: "Courier New", monospace;
  font-size: 0.72rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.8;
  animation: hudTickerGlitch 8s linear infinite;
}

.hud-widget-ticker-line:nth-child(odd) {
  opacity: 1;
}

@keyframes hudTickerGlitch {
  0% {
    opacity: 0.45;
    filter: blur(0px);
  }
  5% {
    opacity: 0.85;
  }
  10% {
    filter: blur(0.5px);
  }
  15% {
    filter: blur(0);
  }
  30% {
    opacity: 0.95;
  }
  100% {
    opacity: 0.6;
  }
}

.hud-widget-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.hud-widget-list-row {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.hud-widget-list-item {
  width: 100%;
  text-align: left;
  background: rgba(0, 255, 102, 0.12);
  border: 1px solid rgba(0, 255, 102, 0.4);
  color: #00ff66;
  font-size: 0.78rem;
  padding: 0.35rem 0.45rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.hud-widget-list-item:hover,
.hud-widget-list-item:focus-visible {
  background: rgba(0, 255, 102, 0.22);
  box-shadow: 0 0 8px rgba(0, 255, 102, 0.4);
  transform: translateY(-1px);
}

.hud-widget-list-item:active {
  transform: translateY(0);
}

.hud-widget-list-item:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.hud-widget-list-summary {
  font-size: 0.68rem;
  color: rgba(0, 255, 102, 0.78);
  margin: 0;
}

.hud-widget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.6rem;
}

.hud-widget-icon-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  text-align: center;
  background: rgba(0, 255, 102, 0.03);
  color: #00ff66;
  padding: 0.5rem 0.45rem 0.45rem;
  border-radius: 0px;
  border: 0px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.hud-widget-icon-tile:hover,
.hud-widget-icon-tile:focus-visible {
  background: rgba(0, 255, 102, 0.3);
  box-shadow: 0 0 0px rgba(0, 255, 102, 0.35);
  transform: translateY(-1px);
  border: 0px;
}

.hud-widget-icon-tile:active {
  transform: translateY(0);
}

.hud-widget-icon-tile:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.hud-widget-icon {
  width: 80px;
  height: 80px;
}

.hud-widget-icon.has-image {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.hud-widget-icon-label {
  font-size: 0.7rem;
  line-height: 1.2;
}

.hud-widget-icon-meta {
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(0, 255, 102, 0.7);
}

.hud-window .hud-widget-icon.has-image {
  filter: grayscale(100%) contrast(1.25) brightness(1.05) sepia(85%) hue-rotate(75deg)
    saturate(220%);
  mix-blend-mode: screen;
}

.hud-window.is-locked .hud-window-header {
  cursor: default;
}

.hud-window.is-locked .hud-window-resizer {
  display: none;
}

.hud-window.is-locked .hud-window-control--max {
  pointer-events: none;
  opacity: 0.35;
}

.hud-window-body .terminal-screen-article {
  max-width: 860px;
  margin: 0 auto;
}

.hud-wildlife-map {
  position: relative;
  display: grid;
  gap: 6px;
  width: 100%;
  aspect-ratio: 3 / 2;
  background: radial-gradient(circle at 30% 30%, rgba(0, 255, 102, 0.08), rgba(0, 0, 0, 0));
  border: 1px dashed rgba(0, 255, 102, 0.35);
  padding: 6px;
  border-radius: 8px;
}

.hud-wildlife-ducts {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hud-wildlife-ducts line {
  stroke: rgba(0, 255, 102, 0.35);
  stroke-width: 0.08;
  vector-effect: non-scaling-stroke;
}

.hud-wildlife-cell {
  border: 1px solid rgba(0, 255, 102, 0.12);
  background: rgba(0, 255, 102, 0.04);
  border-radius: 6px;
}

.hud-wildlife-cell--void {
  opacity: 0.1;
  background: transparent;
  border-style: dotted;
}

.hud-wildlife-dot {
  align-self: center;
  justify-self: center;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #00ff99;
  box-shadow: 0 0 10px rgba(0, 255, 153, 0.8);
  transition: all 0.8s ease;
}

.hud-wildlife-log {
  margin-top: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.hud-wildlife-log-line {
  font-size: 0.72rem;
  color: rgba(0, 255, 102, 0.85);
  margin: 0;
}

.hud-printer {
  background: repeating-linear-gradient(
      to bottom,
      rgba(0, 255, 102, 0.08),
      rgba(0, 255, 102, 0.08) 18px,
      rgba(0, 255, 102, 0.03) 18px,
      rgba(0, 255, 102, 0.03) 36px
    ),
    rgba(0, 0, 0, 0.4);
  border: 1px dashed rgba(0, 255, 102, 0.4);
  border-radius: 6px;
  padding: 0.4rem 0.5rem;
  max-height: 180px;
  overflow: hidden;
}

.hud-printer-line {
  font-family: "Courier New", monospace;
  font-size: 0.75rem;
  margin: 0 0 0.25rem;
  color: #00ff66;
  text-shadow: 0 0 6px rgba(0, 255, 102, 0.4);
}

.hud-module {
  position: absolute;
  background: rgba(0, 20, 0, 0.74);
  border: 1px solid #00ff66;
  border-radius: 10px;
  box-shadow: 0 0 12px rgba(0, 255, 102, 0.35),
    inset 0 0 12px rgba(0, 255, 102, 0.18);
  padding: 1rem 1.1rem;
  color: #00ff66;
  display: none;
  flex-direction: column;
  gap: 0.75rem;
  min-width: clamp(200px, 22vw, 320px);
  max-width: clamp(240px, 26vw, 360px);
  max-height: 60vh;
  overflow: hidden;
  pointer-events: auto;
  z-index: 13;
  backdrop-filter: blur(4px);
}

.hud-module.is-visible {
  display: flex;
}

.hud-module[data-position="top-left"] {
  top: clamp(6.5rem, 10vw, 7.5rem);
  left: clamp(0.75rem, 4vw, 2.5rem);
}

.hud-module[data-position="top-right"] {
  top: clamp(6.5rem, 10vw, 7.5rem);
  right: clamp(0.75rem, 4vw, 2.5rem);
}

.hud-module[data-position="bottom-left"] {
  bottom: clamp(5.5rem, 14vw, 9rem);
  left: clamp(0.75rem, 4vw, 2.5rem);
}

.hud-module[data-position="bottom-right"] {
  bottom: clamp(5.5rem, 14vw, 9rem);
  right: clamp(0.75rem, 4vw, 2.5rem);
}

.hud-module[data-position="left"] {
  top: 50%;
  left: clamp(0.75rem, 4vw, 2.5rem);
  transform: translateY(-50%);
}

.hud-module[data-position="right"] {
  top: 50%;
  right: clamp(0.75rem, 4vw, 2.5rem);
  transform: translateY(-50%);
}

.hud-module[data-position="center"] {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  min-width: clamp(260px, 40vw, 520px);
  max-width: clamp(320px, 52vw, 640px);
}

.hud-module-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.hud-module-title {
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  margin: 0;
}

.hud-module-close {
  background: transparent;
  border: none;
  color: #00ff99;
  font-size: 1rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  text-shadow: 0 0 4px rgba(0, 255, 102, 0.7);
}

.hud-module-close:hover,
.hud-module-close:focus-visible {
  color: #ffffff;
}

.hud-module-content {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 255, 102, 0.4) transparent;
}

.hud-module-content::-webkit-scrollbar {
  width: 6px;
}

.hud-module-content::-webkit-scrollbar-thumb {
  background: rgba(0, 255, 102, 0.4);
  border-radius: 4px;
}

.hud-module-content p {
  margin: 0 0 0.45rem;
}

.hud-module-content ul {
  margin: 0;
  padding-left: 1.1rem;
  list-style: square;
}

.hud-module-content li {
  margin-bottom: 0.35rem;
}

.hud-module-content img {
  display: block;
  width: 100%;
  border-radius: 6px;
  border: 1px solid rgba(0, 255, 102, 0.32);
  box-shadow: 0 0 8px rgba(0, 255, 102, 0.28);
  margin: 0 0 0.6rem;
  filter: grayscale(100%) contrast(1.25) brightness(1.05) sepia(85%) hue-rotate(75deg)
    saturate(220%);
  mix-blend-mode: screen;
}

.hud-module-content .hud-module-image--no-tint {
  filter: none;
  mix-blend-mode: normal;
}

.hud-module-media {
  margin: 0 0 0.5rem;
}

.hud-module-caption {
  margin: 0.25rem 0 0;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.75;
}

.hud-module-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.hud-module-button {
  background: rgba(0, 30, 0, 0.7);
  border: 1px solid rgba(0, 255, 102, 0.55);
  border-radius: 999px;
  color: #00ff99;
  font-family: "Courier New", monospace;
  font-size: 0.8rem;
  padding: 0.35rem 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.hud-module-button:hover,
.hud-module-button:focus-visible {
  background: rgba(0, 60, 0, 0.9);
  color: #ffffff;
  border-color: #00ff99;
  transform: translateY(-1px);
}

.hud-module-button:active {
  transform: translateY(0);
}

.typewriter span {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  border-right: 2px solid #00ff66;
  animation: typing 3s steps(30, end), blink 0.75s step-end infinite;
}

/* RETRO WINDOW */
#retro-window {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  z-index: 20;
}

#retro-window.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.retro-window-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(6px);
  z-index: 0;
}

.retro-window-frame {
  position: relative;
  width: min(92vw, 1100px);
  max-height: min(82vh, 900px);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem;
  background: rgba(0, 10, 0, 0.92);
  border: 1px solid rgba(0, 255, 153, 0.5);
  border-radius: 18px;
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.65), 0 0 45px rgba(0, 255, 153, 0.25), inset 0 0 35px rgba(0, 255, 153, 0.15);
  z-index: 1;
  overflow: hidden;
}

.retro-window-frame::after {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(0, 255, 153, 0.18);
  pointer-events: none;
  opacity: 0.65;
}

.retro-window-header {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(0, 255, 153, 0.2);
  z-index: 1;
}

.retro-window-status {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: clamp(0.9rem, 1.4vw, 1rem);
}

.retro-window-led {
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  background: #00ff99;
  box-shadow: 0 0 12px rgba(0, 255, 153, 0.8);
}

#retro-window-title {
  margin: 0;
}

.retro-window-close {
  background: rgba(0, 255, 153, 0.1);
  border: 1px solid rgba(0, 255, 153, 0.4);
  border-radius: 50%;
  color: #00ff99;
  width: 2.1rem;
  height: 2.1rem;
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.retro-window-close:hover,
.retro-window-close:focus-visible {
  background: rgba(0, 255, 153, 0.28);
  color: #ffffff;
  border-color: rgba(0, 255, 153, 0.8);
}

.retro-window-body {
  position: relative;
  flex: 1;
  overflow-y: auto;
  padding-right: 0.5rem;
  font-size: clamp(0.9rem, 1.5vw, 1.05rem);
  line-height: 1.5;
  color: #e5ffe5;
  z-index: 1;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 255, 153, 0.5) transparent;
}

.retro-window-body::-webkit-scrollbar {
  width: 8px;
}

.retro-window-body::-webkit-scrollbar-thumb {
  background: rgba(0, 255, 153, 0.4);
  border-radius: 999px;
}

.retro-window-body h3,
.retro-window-body h4,
.retro-window-body h5 {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  font-size: clamp(1rem, 1.8vw, 1.25rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #00ffb7;
}

.retro-window-body h3:first-child,
.retro-window-body h4:first-child,
.retro-window-body h5:first-child {
  margin-top: 0;
}

.retro-window-body p {
  margin: 0 0 1rem;
}

.retro-window-body a {
  color: #7dfffb;
}

.retro-window-body pre,
.retro-window-body code {
  font-family: "Courier New", monospace;
  background: rgba(0, 40, 0, 0.6);
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  border: 1px solid rgba(0, 255, 153, 0.25);
}

.retro-window-body ul,
.retro-window-body ol {
  margin: 0 0 1rem 1.2rem;
  padding: 0;
}

/* TERMINAL */
#terminal {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 12;
  background: rgba(0, 10, 0, 0.9);
  border-top: 1px solid #00ff66;
  color: #00ff66;
  font-family: "Courier New", monospace;
  display: flex;
  flex-direction: column;
  max-height: 35vh;
  overflow: hidden;
  font-size: clamp(0.8rem, 2.3vw, 1rem);
  backdrop-filter: blur(4px);
  padding-top: 0;
}

#terminal-collapse {
  background: rgba(0, 20, 0, 0.5);
  border: 1px solid rgba(0, 255, 102, 0.35);
  border-radius: 0.35rem;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  color: #00ff99;
  cursor: pointer;
  font-size: 1rem;
  transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
  pointer-events: auto;
  flex-shrink: 0;
}

#terminal-collapse:hover,
#terminal-collapse:focus-visible {
  color: #ffffff;
  border-color: #00ff99;
  background: rgba(0, 40, 0, 0.7);
}

#terminal.collapsed #terminal-output {
  display: none;
}

#terminal.collapsed {
  max-height: 5rem;
  padding-top: 0;
}

#terminal-output {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 1rem;
}

#terminal-input-line {
  display: flex;
  align-items: center;
  border-top: 1px solid #004422;
  padding: 0.4rem 1rem;
  background: rgba(0, 20, 0, 0.4);
  gap: 0.5rem;
}

#terminal input {
  flex: 1;
  margin-left: 0.25rem;
  background: transparent;
  border: none;
  outline: none;
  color: #00ff66;
  font-family: inherit;
  font-size: inherit;
  min-width: 0;
}

#terminal input::placeholder {
  color: #008844;
}

.terminal-line {
  margin: 2px 0;
}

.terminal-error {
  color: #ff5566;
}

.terminal-success {
  color: #00ff99;
}

#terminal-screen {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(0, 5, 0, 0.98);
  color: #00ff99;
  font-family: "Courier New", monospace;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 0.35s ease, opacity 0.35s ease;
  opacity: 0;
  pointer-events: none;
  border: 1px solid rgba(0, 255, 153, 0.15);
  box-shadow: 0 0 80px rgba(0, 0, 0, 0.9), inset 0 0 45px rgba(0, 255, 153, 0.08);
}

#terminal-screen.is-visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.terminal-screen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(0, 255, 153, 0.2);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: clamp(0.9rem, 1.4vw, 1.1rem);
  background: rgba(0, 20, 0, 0.9);
}

.terminal-screen-close {
  background: rgba(0, 255, 153, 0.12);
  border: 1px solid rgba(0, 255, 153, 0.4);
  color: #00ff99;
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  font-size: 1.25rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.terminal-screen-close:hover,
.terminal-screen-close:focus-visible {
  background: rgba(0, 255, 153, 0.3);
  color: #ffffff;
  border-color: rgba(0, 255, 153, 0.8);
}

.terminal-screen-body {
  flex: 1;
  padding: clamp(1rem, 3vw, 2rem);
  overflow-y: auto;
  line-height: 1.6;
  font-size: clamp(0.9rem, 1.8vw, 1.1rem);
}

.terminal-screen-body::-webkit-scrollbar {
  width: 8px;
}

.terminal-screen-body::-webkit-scrollbar-thumb {
  background: rgba(0, 255, 153, 0.35);
  border-radius: 999px;
}

.terminal-screen-body h3,
.terminal-screen-body h4,
.terminal-screen-body h5 {
  color: #00ffcc;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 1.5rem;
}

.terminal-screen-body h3:first-child,
.terminal-screen-body h4:first-child,
.terminal-screen-body h5:first-child {
  margin-top: 0;
}

.terminal-screen-body p {
  margin: 1rem 0;
  color: #d0ffe0;
}

.terminal-screen-body ul,
.terminal-screen-body ol {
  margin-left: 1.5rem;
  color: #c0ffd0;
}

.terminal-screen-body li + li {
  margin-top: 0.35rem;
}

.terminal-screen-body code {
  background: rgba(0, 255, 153, 0.08);
  border: 1px solid rgba(0, 255, 153, 0.15);
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  color: #00ffb7;
}

.terminal-screen-body img {
  max-width: 100%;
  border: 1px solid rgba(0, 255, 153, 0.2);
  border-radius: 12px;
  margin: 1.5rem 0;
  filter: grayscale(100%) contrast(1.25) brightness(1.05) sepia(85%) hue-rotate(75deg)
    saturate(220%);
  mix-blend-mode: screen;
}

.terminal-screen-body article {
  max-width: 860px;
  margin: 0 auto;
}

.terminal-screen-body a {
  color: #00ffa1;
  text-decoration: underline;
}

.terminal-screen-body .terminal-screen-actions {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.terminal-screen-actions button {
  background: rgba(0, 255, 153, 0.15);
  border: 1px solid rgba(0, 255, 153, 0.4);
  color: #00ff99;
  padding: 0.5rem 1.25rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.terminal-screen-actions button:hover,
.terminal-screen-actions button:focus-visible {
  background: rgba(0, 255, 153, 0.3);
  transform: translateY(-1px);
  color: #ffffff;
}

.terminal-screen-actions button:active {
  transform: translateY(0);
}

.hud-window-body .terminal-screen-actions {
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.hud-window-body .terminal-screen-actions button {
  border: 1px solid rgba(0, 255, 153, 0.35);
  background: rgba(0, 255, 153, 0.08);
  color: #00ffb7;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.hud-window-body .terminal-screen-actions button:hover,
.hud-window-body .terminal-screen-actions button:focus-visible {
  border-color: #00ffb7;
  box-shadow: 0 0 8px rgba(0, 255, 183, 0.4);
  transform: translateY(-1px);
}

/* ANIMATIONS */
@keyframes scanBorder {
  to {
    opacity: 0.2;
    transform: scale(1.02);
  }
}

@keyframes typing {
  from {
    width: 0;
  }

  to {
    width: 100%;
  }
}

@keyframes blink {
  50% {
    border-color: transparent;
  }
}

/* RESPONSIVE */
@media (max-width: 960px) {
  #logo {
    width: 100px;
    top: 0.8rem;
    left: 0.8rem;
  }

  #terminal {
    max-height: 40vh;
  }

  #hud-message {
    min-width: clamp(200px, 60vw, 420px);
  }
}

@media (max-width: 600px) {
  #terminal-input-line {
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
  }

  .prompt {
    font-size: 0.9em;
  }

  .hud-module {
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translate(-50%, -50%);
    width: min(92vw, 360px);
    max-height: 65vh;
  }

  #hud-message {
    top: 5.5rem;
    min-width: min(80vw, 320px);
    font-size: 0.9rem;
  }

  #retro-window .retro-window-frame {
    width: min(96vw, 520px);
    max-height: 88vh;
    padding: 1rem;
  }

  .retro-window-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.65rem;
  }

  .retro-window-close {
    align-self: flex-end;
  }
}
