:root {
  color-scheme: dark;
  --bg: #080b0a;
  --panel: #0d1210;
  --panel-alt: #111815;
  --line: #26342e;
  --text: #d6eadf;
  --muted: #7e9289;
  --accent: #8be9bd;
  --accent-soft: rgba(139, 233, 189, 0.16);
  --shadow: rgba(0, 0, 0, 0.5);
  --error: #ff8f8f;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  color: var(--text);
  font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 16px;
  line-height: 1.6;
  background:
    radial-gradient(circle at 50% 0%, rgba(139, 233, 189, 0.08), transparent 36rem),
    linear-gradient(180deg, #0b100e 0%, var(--bg) 60%);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), transparent 72%);
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), transparent 72%);
}

.shell {
  display: grid;
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  padding: clamp(1rem, 3vw, 2.5rem);
  place-items: center;
  overflow-x: hidden;
}

.terminal {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 760px;
  overflow: hidden;
  background: linear-gradient(180deg, var(--panel-alt), var(--panel));
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 80px var(--shadow), 0 0 0 1px rgba(139, 233, 189, 0.04) inset;
}

.terminal__bar {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 44px;
  padding: 0 1rem;
  gap: 0.5rem;
  background: #121a16;
  border-bottom: 1px solid var(--line);
}

.terminal__dot {
  width: 0.7rem;
  height: 0.7rem;
  border: 1px solid #405047;
  border-radius: 999px;
  background: #19221e;
}

.terminal__title {
  min-width: 0;
  margin-left: auto;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.terminal__screen {
  min-height: 17rem;
  max-height: min(52vh, 28rem);
  padding: clamp(1rem, 3vw, 1.5rem);
  overflow: auto;
  scrollbar-color: var(--line) transparent;
}

.terminal__screen p {
  margin: 0 0 0.4rem;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.terminal__prompt {
  color: var(--accent);
}

.terminal__muted {
  color: var(--muted);
}

.terminal__error {
  color: var(--error);
}

.terminal__link {
  color: var(--accent);
  text-decoration-color: rgba(139, 233, 189, 0.42);
  text-underline-offset: 0.22em;
}

.terminal__link:hover,
.terminal__link:focus-visible {
  color: var(--text);
  outline: none;
  text-decoration-color: var(--accent);
}

.terminal__input-line {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 56px;
  padding: 0 clamp(1rem, 3vw, 1.5rem);
  gap: 0.5rem;
  background: rgba(8, 11, 10, 0.72);
  border-top: 1px solid var(--line);
}

.terminal__input-line:focus-within {
  box-shadow: 0 0 0 3px var(--accent-soft) inset;
}

.terminal__prompt--compact {
  display: none;
}

.terminal__input-line .terminal__prompt {
  flex: 0 0 auto;
}

.terminal__input-wrap {
  position: relative;
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 1.6em;
  text-align: left;
}

.terminal__command {
  display: block;
  width: 100%;
  min-width: 0;
  color: var(--text);
  overflow-wrap: anywhere;
  text-align: left;
  white-space: normal;
}

.terminal__entry {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.terminal__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  color: var(--text);
  font: inherit;
  caret-color: transparent;
  opacity: 0;
  background: transparent;
  border: 0;
  outline: 0;
}

.terminal__cursor {
  display: inline-block;
  width: 0.6rem;
  height: 1.25rem;
  background: var(--muted);
  animation: cursor-blink 1.28s linear infinite;
  transition: opacity 160ms ease, background-color 160ms ease;
  vertical-align: -0.2rem;
}

.terminal--active .terminal__cursor,
.terminal:focus-within .terminal__cursor {
  background: var(--accent);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes cursor-blink {
  0%,
  58% {
    opacity: 0.92;
  }

  62%,
  100% {
    opacity: 0.18;
  }
}

@media (max-width: 520px) {
  body {
    font-size: 14px;
  }

  .shell {
    min-height: 100svh;
    align-items: stretch;
    justify-items: center;
    padding: 0.75rem 0;
  }

  .terminal {
    width: calc(100% - 1.5rem);
    max-width: none;
    min-width: 0;
    min-height: calc(100svh - 1.5rem);
  }

  .terminal__bar {
    min-height: 38px;
    padding-inline: 0.9rem;
  }

  .terminal__dot {
    width: 0.62rem;
    height: 0.62rem;
  }

  .terminal__screen {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    padding: 1rem;
  }

  .terminal__input-line {
    min-height: 58px;
    padding: 0.8rem 1rem;
    gap: 0.45rem;
  }

  .terminal__prompt--full {
    display: none;
  }

  .terminal__prompt--compact {
    display: inline;
  }

  .terminal__input {
    font-size: 16px;
    line-height: 1.4;
  }

  .terminal__cursor {
    width: 0.55rem;
    height: 1.15rem;
  }
}
