/* have you guys ever read that one manga blue box? I think its really good definitely in my top 3 of all manga if not my favorite manga of all time */
:root {
  --bg: #0c0c0c;
  --bg-panel: #141414;
  --text: #c4b5fd;
  --text-dim: #8b7ab8;
  --accent: #a78bfa;
  --accent-alt: #7543e3;
  --prompt-user: #b794f6;
  --prompt-path: #9f7aea;
  --glow: rgba(167, 139, 250, 0.2);
  --scanline: rgba(0, 0, 0, 0.12);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  cursor: none;
}

html {
  font-size: 16px;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Mono", "Courier New", monospace;
  line-height: 1.6;
  overflow-x: hidden;
  cursor: none;
}

/* CRT effects */
.crt-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  background: radial-gradient(
    ellipse at center,
    transparent 0%,
    rgba(0, 0, 0, 0.25) 80%,
    rgba(0, 0, 0, 0.6) 100%
  );
}

.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 99;
  background: repeating-linear-gradient(
    0deg,
    var(--scanline) 0px,
    var(--scanline) 1px,
    transparent 1px,
    transparent 3px
  );
  animation: flicker 8s infinite;
}

@keyframes flicker {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 0.92; }
  52% { opacity: 0.78; }
  54% { opacity: 0.92; }
}

.terminal {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  text-shadow: 0 0 8px var(--glow);
}

.terminal-header {
  margin-bottom: 2rem;
}

.ascii-art {
  color: var(--accent);
  font-size: clamp(0.55rem, 2.2vw, 0.75rem);
  line-height: 1.2;
  white-space: pre;
  overflow-x: auto;
  margin-bottom: 0.75rem;
}

.boot-line {
  color: var(--text-dim);
  font-size: 0.85rem;
}

.boot-line::before {
  content: "[OK] ";
  color: var(--accent-alt);
}

.console-motd {
  margin-bottom: 1rem;
  color: var(--text);
  white-space: pre-wrap;
  line-height: 1.6;
  font-size: 0.95rem;
}

.block {
  margin-bottom: 1.75rem;
}

.reveal-unit {
  opacity: 0;
  visibility: hidden;
}

.reveal-unit.is-visible {
  opacity: 1;
  visibility: visible;
}

body.is-revealing .console-input {
  pointer-events: none;
}

.prompt-line {
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.prompt {
  color: var(--prompt-user);
}

.path {
  color: var(--prompt-path);
}

.command {
  color: var(--text);
  margin-left: 0.35rem;
}

.output {
  padding-left: 1rem;
  border-left: 2px solid var(--accent-alt);
  margin-left: 0.25rem;
}

.name {
  font-size: clamp(1.5rem, 5vw, 2rem);
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.02em;
  margin-bottom: 0.25rem;
}

.tagline {
  color: var(--text-dim);
  font-size: 0.9rem;
}

.about p {
  margin-bottom: 0.75rem;
  color: var(--text);
  font-size: 0.95rem;
}

.about p:last-child {
  margin-bottom: 0;
}

.links {
  list-style: none;
}

.links li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: baseline;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.link-prefix {
  color: var(--text-dim);
  font-size: 0.8rem;
  min-width: 5.5rem;
}

.links-hint {
  margin-top: 0.75rem;
  padding-left: 1rem;
  border-left: 2px solid var(--accent-alt);
  margin-left: 0.25rem;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.links a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s, text-shadow 0.15s;
}

.links a:hover,
.links a:focus-visible {
  color: #ddd6fe;
  text-shadow: 0 0 12px var(--accent-alt);
  outline: none;
}

.links a:focus-visible {
  text-decoration: underline;
}

.active-prompt .cursor,
.console-input-line .cursor {
  display: inline-block;
  color: var(--text);
  animation: blink 1s step-end infinite;
  margin-left: 0.1rem;
}

.console {
  margin-top: 0.5rem;
}

.console-history {
  margin-bottom: 0.5rem;
}

.console-entry {
  margin-bottom: 0.75rem;
}

.console-entry .command {
  color: var(--text);
  margin-left: 0.35rem;
  word-break: break-word;
}

.console-entry .console-output {
  margin-top: 0.35rem;
  padding-left: 1rem;
  border-left: 2px solid var(--accent-alt);
  margin-left: 0.25rem;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.console-entry .console-output.dim {
  color: var(--text-dim);
}

.console-input-line {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  cursor: text;
}

.console-mirror {
  color: var(--text);
  margin-left: 0.35rem;
  min-width: 0.5ch;
  word-break: break-word;
}

.console-input {
  position: absolute;
  inset: 0;
  width: 100%;
  opacity: 0;
  cursor: text;
  border: none;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  font: inherit;
  padding: 0;
  margin: 0;
}

.console.is-focused .console-input-line {
  text-shadow: 0 0 10px var(--glow);
}

.console-input-line:focus-within .cursor {
  animation: blink 1s step-end infinite;
}

body.is-booting .console-input {
  pointer-events: none;
}

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

.terminal-footer {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--text-dim);
  font-size: 0.75rem;
  color: var(--text-dim);
}

.terminal-footer span {
  color: var(--accent-alt);
}

/* Subtle screen curvature on larger displays */
@media (min-width: 640px) {
  .terminal {
    padding-top: 3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scanlines {
    animation: none;
  }

  .active-prompt .cursor {
    animation: none;
  }

  .console-input-line .cursor {
    animation: none;
  }

  .bios-screen {
    transition: none;
  }

  .terminal {
    transition: none;
  }

  .reveal-unit {
    opacity: 1;
    visibility: visible;
    animation: none;
  }
}

/* BIOS startup screen */
.bios-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Mono", "Courier New", monospace;
  font-size: clamp(0.75rem, 2.5vw, 0.9rem);
  line-height: 1.5;
  text-shadow: 0 0 6px var(--glow);
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.bios-screen.is-exiting {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.bios-header {
  margin-bottom: 1.5rem;
}

.bios-logo {
  color: var(--accent);
  font-size: clamp(0.45rem, 1.8vw, 0.6rem);
  line-height: 1.15;
  white-space: pre;
  margin-bottom: 0.5rem;
}

.bios-version {
  color: var(--text-dim);
  font-size: 0.85em;
}

.bios-body {
  flex: 1;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.bios-lines {
  min-height: 8rem;
}

.bios-line {
  margin-bottom: 0.15rem;
  opacity: 0;
  animation: bios-line-in 0.15s ease forwards;
}

.bios-line.dim {
  color: var(--text-dim);
}

.bios-line.highlight {
  color: var(--accent);
}

.bios-line.ok::after {
  content: " ... OK";
  color: var(--accent-alt);
}

@keyframes bios-line-in {
  from {
    opacity: 0;
    transform: translateY(2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.bios-memory {
  margin: 0.75rem 0 1rem;
  color: var(--text);
}

.bios-memory #bios-memory-count {
  color: var(--accent);
  min-width: 5ch;
  display: inline-block;
  text-align: right;
}

.bios-progress {
  width: 100%;
  max-width: 420px;
  height: 4px;
  margin-top: 1rem;
  background: rgba(139, 122, 184, 0.2);
  border: 1px solid var(--text-dim);
}

.bios-progress-bar {
  width: 0%;
  height: 100%;
  background: var(--accent-alt);
  box-shadow: 0 0 8px var(--glow);
  transition: width 0.3s ease;
}

.bios-footer {
  margin-top: auto;
  padding-top: 1rem;
}

.bios-prompt {
  color: var(--text-dim);
  animation: bios-blink 1.2s step-end infinite;
}

.bios-cursor {
  color: var(--text);
}

@keyframes bios-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

body.is-booting {
  overflow: hidden;
}

body.is-booting .terminal {
  opacity: 0;
  visibility: hidden;
}

.terminal {
  transition: opacity 0.5s ease 0.15s, visibility 0.5s ease 0.15s;
}

body.is-ready .terminal {
  opacity: 1;
  visibility: visible;
}

/* megadeath command */
body.megadeath-active {
  animation: megadeath-shake 0.08s steps(2) infinite;
}

body.megadeath-active .terminal {
  animation: megadeath-flicker 0.06s steps(2) infinite;
}

body.megadeath-active .crt-overlay,
body.megadeath-active .scanlines {
  animation: megadeath-scan 0.04s steps(2) infinite;
}

@keyframes megadeath-shake {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-3px, 1px); }
  50% { transform: translate(2px, -2px); }
  75% { transform: translate(-1px, 2px); }
  100% { transform: translate(1px, -1px); }
}

@keyframes megadeath-flicker {
  0% { filter: hue-rotate(0deg) brightness(1); }
  50% { filter: hue-rotate(90deg) brightness(1.4); }
  100% { filter: hue-rotate(-60deg) brightness(0.7); }
}

@keyframes megadeath-scan {
  0% { opacity: 0.85; }
  50% { opacity: 0.4; }
  100% { opacity: 1; }
}

body.megadeath-blackout .terminal,
body.megadeath-blackout .crt-overlay,
body.megadeath-blackout .scanlines {
  opacity: 0 !important;
  visibility: hidden;
  transition: none;
}

body.megadeath-blackout {
  background: #000 !important;
}

.connection-lost {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 1.2s ease;
}

.connection-lost.is-visible {
  opacity: 1;
  visibility: visible;
}

.connection-lost-text {
  font-size: clamp(1.1rem, 4vw, 1.75rem);
  font-weight: 600;
  letter-spacing: 0.4em;
  color: var(--text);
  text-shadow: 0 0 24px var(--glow);
  animation: connection-lost-pulse 2.5s ease-in-out infinite;
}

@keyframes connection-lost-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

@media (prefers-reduced-motion: reduce) {
  body.megadeath-active,
  body.megadeath-active .terminal,
  body.megadeath-active .crt-overlay,
  body.megadeath-active .scanlines {
    animation: none;
  }

  .connection-lost-text {
    animation: none;
  }
}

