html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #121212;
  font-family: "Fira Code", monospace;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10000;
  box-shadow: 0 0 80px 20px rgba(0, 255, 204, 0.03) inset;
  background-image:
  repeating-linear-gradient(to bottom, rgba(0,255,204,0.25) 1px, transparent 3px),
  linear-gradient(135deg, rgba(255,255,255,0.03) 0%, transparent 40%);
  animation: crt-flicker 90ms steps(1, end) infinite,
             scan-drift 4s linear infinite;
  mix-blend-mode: overlay;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9995;
  background-image:
    radial-gradient(circle at center, rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0.5) 100%),
    radial-gradient(circle, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size:
    cover,
    2px 2px;
  mix-blend-mode: overlay;
}

.crt-warp {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10002;
  mix-blend-mode: screen;
  background: linear-gradient(to bottom, transparent 48%, rgba(255,255,255,0.06) 50%, transparent 52%);
  animation: sweepWarp 3s ease-out 0.8s forwards;
  opacity: 0;
}

@keyframes scan-drift {
  0% { background-position-y: 0; }
  100% { background-position-y: 4px; }
}

@keyframes sweepWarp {
  0% {
    opacity: 0.1;
    transform: scaleY(1) scaleX(1);
    filter: blur(0.6px) contrast(2);
  }
  10% {
    opacity: 0.3;
    transform: scaleY(1.04) scaleX(1.02);
    filter: blur(0.8px) contrast(2.5);
  }
  100% {
    opacity: 0;
    transform: scaleY(1) scaleX(1);
    filter: blur(0px) contrast(1);
  }
}

@keyframes crt-flicker {
  0%, 100% {
    opacity: 0.08;
  }
  50% {
    opacity: 0.15;
  }
}

#boot-overlay {
  position: fixed;
  top: 50%;
  left: 50%;
  background: #0e0e0e;
  border: 2px solid #00ffcc;
  box-shadow: 0 0 20px #00ffcc88;
  color: #00ffcc;
  transform: translate(-50%, -50%) scale(0);
  width: clamp(280px, 90vw, 480px);
  max-width: 480px;
  height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: expandIn 0.6s ease-out forwards;
  z-index: 9999;
}

@keyframes expandIn {
  to {
    transform: translate(-50%, -50%) scale(1);
  }
}

.boot-hide {
  animation: collapseOut 0.6s ease-in forwards;
}

@keyframes collapseOut {
  to {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
  }
}

.boot-container {
  padding: 16px;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

.logo-block {
  text-align: center;
  height: calc(1.2em * 6);
  overflow: hidden;
  margin-bottom: 8px;
}

.logo-ascii {
  font-size: 0.9rem;
  line-height: 1.2;
  white-space: pre;
  text-shadow: 0 0 2px #00ffee, 0 0 8px #00ffee88;
  animation: glow-pulse 2s infinite alternate;
}

.logo-ascii.active-glow {
  animation: glow-intense 1.2s ease-in-out infinite alternate;
}

@keyframes glow-pulse {
  0% { text-shadow: 0 0 2px #00ffee, 0 0 6px #00ffee44; }
  100% { text-shadow: 0 0 3px #00ffee, 0 0 8px #00ffee88; }
}

@keyframes glow-intense {
  0% { text-shadow: 0 0 4px #00ffee, 0 0 10px #00ffeeaa; }
  100% { text-shadow: 0 0 6px #00ffee, 0 0 16px #00ffeecc; }
}

.boot-sequence {
  font-size: 1rem;
  line-height: 1.4;
  min-height: 4em;
  color: transparent;
  position: relative;
  white-space: pre-wrap;
  padding-left: 2ch; /* Align under logo */
}

.boot-sequence::before,
.boot-sequence::after {
  content: attr(data-content);
  position: absolute;
  top: 0;
  left: 2ch; /*and this one too */
  white-space: pre-wrap;
  pointer-events: none;
}

.boot-sequence::before {
  color: #00ffcc88;
  transform: translateX(-1px);
}

.boot-sequence::after {
  color: #ff00ff66;
  transform: translateX(1px);
}

.boot-sequence span.cursor {
  color: #00ffcc;
  animation: blink 1s steps(1) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.boot-flash {
  position: fixed;
  inset: 0;
  background: white;
  opacity: 0;
  pointer-events: none;
  z-index: 10004;
}

.boot-flash.active {
  animation: flash-out 0.4s ease-in forwards;
}

@keyframes flash-out {
  0% { opacity: 0; }
  20% { opacity: 1; }
  100% { opacity: 0; }
}

@media (max-width: 460px) {
  .logo-ascii {
    font-size: 0.75rem;
  }
  .boot-sequence {
    font-size: 0.75rem;
  }
}

@media (max-width: 380px) {
  .logo-ascii {
    font-size: 0.65rem;
  }
  .boot-sequence {
    font-size: 0.65rem;
    padding-inline: 2ch;
    box-sizing: border-box;
  }
}
