@import url("https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&display=swap");

:root {
  color-scheme: dark;
  --bg: #090b10;
  --bg-2: #10141d;
  --panel: #303a4a;
  --line: rgba(255, 255, 255, 0.08);
  --text: #e8edf7;
  --muted: #9aa6bf;
  --green: #7cf0c4;
  --blue: #8aa9ff;
  --pink: #ef7ae5;
  --banner-left: #ff60ba;
  --banner-right: #60afff;
  --name-color: #5d8dda;
  --version-color: #617080;
  --start-color: #56c595;
  --stop-color: #c54c7b;
  --terminal-text-size: clamp(1.05rem, 1.3vw, 1.35rem);
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.45);
  --radius-xl: 20px;
  --radius-lg: 14px;
  --radius-md: 10px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(circle at top, rgba(124, 240, 196, 0.06), transparent 28%),
    radial-gradient(circle at 82% 16%, rgba(138, 169, 255, 0.09), transparent 24%),
    linear-gradient(180deg, #1c2432 0%, #111723 38%, #090b10 100%);
  color: var(--text);
  font-family: "Space Mono", "Courier New", monospace;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

a {
  color: inherit;
}

::selection {
  background: transparent;
  color: inherit;
}

::-moz-selection {
  background: transparent;
  color: inherit;
}

.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(rgba(255, 255, 255, 0.02) 50%, transparent 50%);
  background-size: 100% 4px;
  mix-blend-mode: soft-light;
  opacity: 0.3;
}

.bubblefield {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.bubblefield span {
  position: absolute;
  bottom: -12vh;
  left: var(--x);
  width: var(--s);
  height: var(--s);
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 60%),
    linear-gradient(180deg, rgba(138, 169, 255, 0.24), rgba(124, 240, 196, 0.12));
  filter: blur(6px);
  opacity: var(--o);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 0 22px rgba(138, 169, 255, 0.14);
  animation: bubbleRise var(--d) linear infinite;
  animation-delay: var(--delay);
  will-change: transform, opacity;
}

.bubblefield span.is-typed {
  bottom: 0;
  filter: blur(2px);
  opacity: var(--o);
  animation: typedBubbleRise var(--d) linear 1 forwards;
  animation-delay: 0s;
}

.bubblefield span:nth-child(1) { --x: 8%; --s: 12px; --o: 0.55; --d: 18s; --delay: -2s; }
.bubblefield span:nth-child(2) { --x: 15%; --s: 9px; --o: 0.42; --d: 15s; --delay: -9s; }
.bubblefield span:nth-child(3) { --x: 24%; --s: 16px; --o: 0.35; --d: 22s; --delay: -7s; }
.bubblefield span:nth-child(4) { --x: 33%; --s: 10px; --o: 0.46; --d: 17s; --delay: -12s; }
.bubblefield span:nth-child(5) { --x: 42%; --s: 14px; --o: 0.3; --d: 20s; --delay: -4s; }
.bubblefield span:nth-child(6) { --x: 51%; --s: 8px; --o: 0.55; --d: 14s; --delay: -11s; }
.bubblefield span:nth-child(7) { --x: 60%; --s: 15px; --o: 0.32; --d: 21s; --delay: -5s; }
.bubblefield span:nth-child(8) { --x: 67%; --s: 11px; --o: 0.48; --d: 16s; --delay: -8s; }
.bubblefield span:nth-child(9) { --x: 74%; --s: 18px; --o: 0.28; --d: 24s; --delay: -16s; }
.bubblefield span:nth-child(10) { --x: 81%; --s: 10px; --o: 0.5; --d: 19s; --delay: -6s; }
.bubblefield span:nth-child(11) { --x: 88%; --s: 13px; --o: 0.36; --d: 23s; --delay: -13s; }
.bubblefield span:nth-child(12) { --x: 94%; --s: 9px; --o: 0.42; --d: 17s; --delay: -10s; }

@keyframes bubbleRise {
  0% {
    transform: translateY(0) scale(0.9);
  }
  50% {
    transform: translateY(-50vh) translateX(var(--drift, 8px)) scale(1.05);
  }
  100% {
    transform: translateY(-118vh) translateX(var(--drift2, -10px)) scale(0.95);
  }
}

@keyframes typedBubbleRise {
  0% {
    transform: translateY(0) scale(0.72);
    opacity: 0;
  }
  2% {
    opacity: var(--o);
  }
  10% {
    transform: translateY(-10vh) translateX(calc(var(--drift, 8px) * 0.3)) scale(1.07);
  }
  22% {
    transform: translateY(-34vh) translateX(calc(var(--drift, 8px) * 0.55)) scale(1.04);
  }
  40% {
    transform: translateY(-62vh) translateX(var(--drift, 8px)) scale(1.0);
  }
  58% {
    transform: translateY(-96vh) translateX(var(--drift2, -10px)) scale(0.96);
  }
  100% {
    transform: translateY(-160vh) translateX(var(--drift2, -10px)) scale(0.92);
    opacity: var(--o);
  }
}

.shell {
  width: min(1080px, calc(100% - 24px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  place-items: center;
  padding: 18px 0;
  position: relative;
  z-index: 1;
}

.shell::before,
.shell::after {
  content: "";
  position: fixed;
  border-radius: 999px;
  pointer-events: none;
  filter: blur(8px);
  opacity: 0.32;
}

.shell::before {
  width: 240px;
  height: 240px;
  top: 70px;
  right: -90px;
  background: radial-gradient(circle, rgba(239, 122, 229, 0.3), transparent 66%);
}

.shell::after {
  width: 280px;
  height: 280px;
  bottom: -120px;
  left: -110px;
  background: radial-gradient(circle, rgba(138, 169, 255, 0.22), transparent 66%);
}

.boot,
.terminal {
  width: 100%;
  max-width: 1020px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(180deg, rgba(48, 58, 74, 0.56), rgba(40, 49, 63, 0.56));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.boot {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(940px, calc(100% - 24px));
  height: fit-content;
  display: grid;
  gap: 18px;
  padding: 24px;
  z-index: 20;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 220ms ease, transform 220ms ease;
}

html.boot-pending .boot {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

html.skip-boot .boot {
  display: none;
}

.boot__ascii,
.banner {
  margin: 0;
  margin-bottom: 4px;
  width: max-content;
}

.boot__ascii {
  display: grid;
  gap: 0;
}

.boot__ascii-line,
.banner__line {
  margin: 0;
  font-family: "Space Mono", monospace;
  color: var(--banner-left);
  white-space: pre;
  width: max-content;
}

.boot__ascii-line {
  font-size: clamp(0.62rem, 1.2vw, 0.95rem);
  line-height: 1.65;
}

.banner__line {
  font-size: clamp(1.06rem, 1.85vw, 1.45rem);
  line-height: 1.55;
}

.boot__ascii-line .char,
.banner__line .char {
  color: var(--c, var(--banner-left));
}

.boot__panel {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.02);
}

.boot__title {
  font-family: "Space Mono", monospace;
  font-size: clamp(0.62rem, 1.4vw, 0.82rem);
  letter-spacing: 0.04em;
  text-transform: lowercase;
}

.boot__subtitle {
  margin: 0;
  color: var(--muted);
  font-size: var(--terminal-text-size);
  line-height: 1;
}

.boot__bar {
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
}

.boot__bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--blue), var(--pink));
  box-shadow: 0 0 18px rgba(124, 240, 196, 0.3);
}

.boot__log {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: var(--terminal-text-size);
}

.boot__log li::before {
  content: "> ";
  color: var(--green);
}

.terminal {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 240ms ease, transform 240ms ease;
  position: relative;
  z-index: 1;
  height: min(84vh, 900px);
  min-height: 620px;
}

html.skip-boot .terminal,
html.is-ready .terminal {
  opacity: 1;
  transform: translateY(0);
}

.terminal__top {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
}

.terminal__dots {
  display: flex;
  gap: 8px;
}

.terminal__dots span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
}

.terminal__dots span:first-child {
  background: #ff5f57;
}

.terminal__dots span:nth-child(2) {
  background: #febc2e;
}

.terminal__dots span:last-child {
  background: #28c840;
}

.terminal__title {
  flex: 0;
  text-align: left;
  color: var(--version-color);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.terminal__status {
  color: var(--name-color);
  font-size: 0.95rem;
  margin-left: auto;
}

.terminal__body {
  padding: 18px 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  align-items: flex-start;
  justify-content: flex-start;
  scrollbar-width: none;
  -ms-overflow-style: none;
  overscroll-behavior: contain;
}

.terminal__body::-webkit-scrollbar {
  display: none;
}

.terminal__history {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  min-height: 0;
  position: relative;
  width: 100%;
  gap: 14px;
}

.term-entry {
  display: grid;
  gap: 8px;
  width: 100%;
}

.term-entry__head {
  margin: 0;
}

.term-entry__command {
  color: var(--text);
}

.term-entry__stream {
  display: grid;
  gap: 8px;
  width: 100%;
}

.term-entry__head:hover .char,
.term-entry__stream > .output:hover .char,
.term-entry__stream > .link:hover .char,
.term-entry--intro > .output:hover .char,
.terminal__echo:hover .char,
.boot__ascii-line:hover .char,
.banner__line:hover .char {
  animation: charWave 2200ms linear infinite;
  animation-delay: calc(var(--p, 0) * 120ms);
  display: inline-block;
}

.char {
  display: inline-block;
  white-space: pre;
  will-change: transform;
  transition: transform 260ms ease-out;
}

.term-entry__stream > .output,
.term-entry__stream > .link,
.term-entry--intro > .output,
.terminal__echo,
.boot__log li {
  line-height: 1.15;
  min-height: 1.15em;
}

.char.is-hidden {
  opacity: 0;
}

.terminal__composer {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 0 0 16px;
  border-top: 0;
  background: transparent;
  min-width: 0;
  width: 100%;
  flex-wrap: nowrap;
  position: relative;
}

.terminal__composer .prompt {
  font-size: var(--terminal-text-size);
  line-height: 1.15;
}

.terminal__echo {
  color: var(--muted);
  font: inherit;
  font-size: var(--terminal-text-size);
  line-height: 1.15;
  white-space: pre;
  min-width: 0;
  flex: 0 0 auto;
}

.terminal__input {
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  max-width: 100%;
  opacity: 0;
  min-width: 1ch;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: var(--terminal-text-size);
  outline: none;
  caret-color: transparent;
  padding: 0;
  margin: 0;
  appearance: none;
  pointer-events: auto;
}

.terminal__input::placeholder {
  color: rgba(154, 166, 191, 0.6);
}

.terminal__cursor {
  color: var(--stop-color);
  animation: blink 1s steps(1, end) infinite;
  line-height: 1;
  margin-top: 0;
}

.block {
  display: grid;
  gap: 8px;
}

.promptline {
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: var(--terminal-text-size);
  line-height: 1.2;
}

.prompt {
  color: var(--start-color);
  margin-right: 0;
  white-space: nowrap;
}

.output {
  font-size: var(--terminal-text-size);
  line-height: 1.15;
}

.output--muted {
  color: var(--muted);
  max-width: 54ch;
}

.output--accent {
  color: var(--blue);
}

.links {
  display: grid;
  gap: 6px;
  padding-top: 2px;
}

.link {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  padding: 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.link:first-child {
  border-top: 0;
  padding-top: 0;
}

.link:hover .link__label,
.link:hover .link__value {
  color: var(--green);
}

.link:hover {
  color: var(--text);
}

.link__icon {
  width: 22px;
  height: 22px;
  color: var(--blue);
  display: grid;
  place-items: center;
  flex: none;
}

.link__icon svg {
  width: 18px;
  height: 18px;
}

.link__label {
  min-width: 78px;
  font-size: var(--terminal-text-size);
}

.link__value {
  margin-left: auto;
  color: var(--muted);
  font-size: var(--terminal-text-size);
}

.terminal__nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.015);
  flex: none;
}

.navbtn {
  appearance: none;
  border: 0;
  background: rgba(30, 36, 48, 0.98);
  color: var(--muted);
  font: inherit;
  font-size: var(--terminal-text-size);
  padding: 14px 12px;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.navbtn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.navbtn.is-active {
  color: var(--green);
  background: linear-gradient(180deg, rgba(124, 240, 196, 0.06), rgba(255, 255, 255, 0.01));
  box-shadow: inset 0 1px 0 rgba(124, 240, 196, 0.1);
}

.terminal.is-switching .terminal__body,
.terminal.is-switching .terminal__nav,
.terminal.is-switching .terminal__composer {
  opacity: 0.55;
}

.terminal.is-switching .terminal__top,
.terminal.is-switching .banner {
  animation: flash 180ms ease;
}

@keyframes flash {
  0% {
    filter: brightness(1.1);
    opacity: 0.55;
  }
  100% {
    filter: brightness(1);
    opacity: 1;
  }
}

@keyframes charWave {
  0% {
    transform: translateY(0);
  }
  20% {
    transform: translateY(-1px);
  }
  40% {
    transform: translateY(0.8px);
  }
  60% {
    transform: translateY(-0.6px);
  }
  80% {
    transform: translateY(0.8px);
  }
  100% {
    transform: translateY(0);
  }
}

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

@media (max-width: 860px) {
  .shell {
    width: min(100% - 14px, 940px);
    padding: 10px 0;
  }

  .terminal {
    height: min(88vh, 840px);
    min-height: 560px;
  }

  .terminal__body,
  .boot {
    padding-left: 14px;
    padding-right: 14px;
  }

  .terminal__top {
    padding: 12px 14px;
  }

  .terminal__composer {
    padding-left: 14px;
    padding-right: 14px;
  }

  .terminal__title {
    font-size: 0.92rem;
  }
}

@media (max-width: 620px) {
  .terminal {
    height: min(90vh, 760px);
    min-height: 520px;
  }

  .terminal__body {
    padding: 16px;
  }

  .terminal__composer {
    padding: 0 16px 14px;
  }

  .terminal__top {
    flex-wrap: wrap;
  }

  .terminal__title {
    order: 3;
    width: 100%;
    text-align: left;
  }

  .terminal__status {
    margin-left: auto;
  }

  .link {
    gap: 10px;
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .link__label {
    min-width: unset;
  }

  .link__value {
    width: 100%;
    margin-left: 38px;
  }

  .output,
  .promptline,
  .terminal__input {
    font-size: clamp(1rem, 4.2vw, 1.25rem);
  }

  .banner {
    font-size: clamp(0.9rem, 3vw, 1.1rem);
  }

  .boot__ascii {
    font-size: clamp(0.62rem, 2.2vw, 0.8rem);
  }

  .boot__subtitle {
    font-size: clamp(1rem, 4.2vw, 1.25rem);
  }

  .terminal__nav {
    grid-template-columns: 1fr;
  }

  .navbtn {
    padding: 16px 10px;
    font-size: clamp(1.2rem, 4.8vw, 1.45rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
