:root {
  --boot-bg: #06100b;
  --boot-panel: rgba(8, 16, 12, 0.88);
  --boot-border: rgba(99, 255, 159, 0.26);
  --boot-text: #c5ffe0;
  --boot-muted: #93ddb3;
  --boot-accent: #63ff9f;
  --boot-glow: rgba(99, 255, 159, 0.16);
  --boot-shadow: rgba(0, 0, 0, 0.45);
}

#boot-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 10%, rgba(99, 255, 159, 0.08), transparent 20%),
    radial-gradient(circle at 80% 10%, rgba(99, 255, 159, 0.05), transparent 20%),
    linear-gradient(180deg, #050b08 0%, #040705 100%);
  opacity: 1;
  transition: opacity 600ms ease, visibility 600ms ease;
}

#boot-overlay.is-fading {
  opacity: 0;
  visibility: hidden;
}

.boot-stage {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
}

.terminal-window {
  position: relative;
  width: min(1000px, 92vw);
  height: min(620px, 78vh);
  background: var(--boot-panel);
  border: 1px solid var(--boot-border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow:
    0 20px 60px var(--boot-shadow),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 0 40px var(--boot-glow);
  transform-origin: top center;
  transition: transform 900ms cubic-bezier(.2,.9,.15,1), opacity 700ms ease;
}

.terminal-window.is-collapsing {
  transform:
    translate(var(--collapse-x, 0), var(--collapse-y, -220px))
    scale(var(--collapse-scale, 0.24));
  opacity: 0.1;
}

.terminal-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(197, 255, 224, 0.35);
}

.terminal-title {
  margin-left: 6px;
  color: var(--boot-muted);
  font-size: 13px;
  letter-spacing: 0.04em;
}

.terminal-body {
  position: relative;
  height: calc(100% - 42px);
  padding: 18px 18px 20px;
  overflow: hidden;
}

.boot-output {
  margin: 0;
  height: calc(100% - 34px);
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--boot-text);
  font-size: 14px;
  line-height: 1.5;
  text-shadow: 0 0 10px rgba(99, 255, 159, 0.16);
}

.prompt-line {
  display: flex;
  align-items: center;
  min-height: 28px;
  font-size: 14px;
  color: var(--boot-text);
}

.prompt-label {
  margin-right: 8px;
  color: var(--boot-accent);
}

.cursor {
  display: inline-block;
  margin-left: 1px;
  color: var(--boot-accent);
  animation: cursor-blink 1s steps(1) infinite;
}

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

.boot-scanlines,
.boot-noise {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.boot-scanlines {
  opacity: 0.08;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.08) 0px,
      rgba(255, 255, 255, 0.08) 1px,
      transparent 2px,
      transparent 4px
    );
  mix-blend-mode: soft-light;
}

.boot-noise {
  opacity: 0.04;
  background-image:
    radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.35) 0.5px, transparent 0.7px),
    radial-gradient(circle at 75% 35%, rgba(255, 255, 255, 0.22) 0.5px, transparent 0.7px),
    radial-gradient(circle at 50% 80%, rgba(255, 255, 255, 0.25) 0.5px, transparent 0.7px);
  background-size: 4px 4px, 5px 5px, 6px 6px;
  animation: noise-drift 0.25s steps(2) infinite;
}

@keyframes noise-drift {
  0% { transform: translate(0, 0); }
  50% { transform: translate(-1px, 1px); }
  100% { transform: translate(1px, -1px); }
}

#boot-collapse-target {
  position: fixed;
  top: 16px;
  left: 20px;
  width: 220px;
  height: 48px;
  pointer-events: none;
  opacity: 0;
}

.skip-boot {
  position: absolute;
  right: 24px;
  bottom: 22px;
  border: 1px solid var(--boot-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--boot-muted);
  padding: 8px 12px;
  font: inherit;
  cursor: pointer;
}

.skip-boot:hover {
  background: rgba(99, 255, 159, 0.08);
}

.boot-flash {
  animation: boot-flash 180ms ease;
}

@keyframes boot-flash {
  0% { filter: brightness(1); }
  40% { filter: brightness(1.35); }
  100% { filter: brightness(1); }
}

.boot-glitch {
  animation: boot-glitch 260ms linear 1;
}

@keyframes boot-glitch {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-1px, 1px); }
  40% { transform: translate(2px, -1px); }
  60% { transform: translate(-2px, 0); }
  80% { transform: translate(1px, 1px); }
  100% { transform: translate(0, 0); }
}

@media (max-width: 700px) {
  .terminal-window {
    width: 94vw;
    height: 74vh;
  }

  .boot-output,
  .prompt-line {
    font-size: 12px;
  }

  .skip-boot {
    right: 18px;
    bottom: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cursor,
  .boot-noise {
    animation: none !important;
  }

  #boot-overlay,
  .terminal-window {
    transition: none !important;
  }
}
