:root {
  color-scheme: dark;
  --vh: 1vh;
  --green: #18d656;
  --amber: #ffcf55;
  --blue: #39a7ff;
  --red: #ff5a5a;
  --white: #f3f8ef;
  --muted: #83a186;
  --panel: rgba(0, 0, 0, 0.82);
  --line: rgba(255, 255, 255, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: #030603;
  color: var(--white);
  font-family: "VT323", "Courier New", monospace;
}

body {
  height: calc(var(--vh) * 100);
  overflow: hidden;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at center, rgba(35, 86, 43, 0.2) 0%, rgba(0, 0, 0, 0.1) 48%, rgba(0, 0, 0, 0.95) 100%),
    linear-gradient(180deg, rgba(24, 214, 86, 0.06), rgba(0, 0, 0, 0.15));
  pointer-events: none;
  z-index: -2;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0, 0, 0, 0.42) 5px);
  opacity: 0.35;
  pointer-events: none;
  z-index: 5;
}

#terminal {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: calc(var(--vh) * 100);
  min-height: 420px;
  padding: clamp(10px, 2vw, 22px);
  background: var(--panel);
  text-shadow: 0 0 8px rgba(24, 214, 86, 0.34);
  position: relative;
  overflow: hidden;
}

#output {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  white-space: pre-wrap;
  font-size: clamp(18px, 2.1vw, 25px);
  line-height: 1.12;
  padding: 2px 6px 16px 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.38) rgba(0, 0, 0, 0.45);
}

#output::-webkit-scrollbar {
  width: 9px;
}

#output::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.45);
}

#output::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.38);
}

#input-section {
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  flex-shrink: 0;
}

#prompt {
  color: var(--green);
  font-size: clamp(20px, 2.4vw, 28px);
  min-width: max-content;
}

#terminal-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--white);
  caret-color: var(--green);
  font: inherit;
  font-size: clamp(20px, 2.4vw, 28px);
  line-height: 1;
  padding: 0;
}

.scan-line {
  position: fixed;
  top: -120px;
  left: 0;
  width: 100%;
  height: 20px;
  background: rgba(255, 255, 255, 0.035);
  pointer-events: none;
  animation: scanline 10s linear infinite;
  z-index: 6;
}

.line {
  margin: 0;
  min-height: 1.12em;
}

.command-line {
  color: var(--green);
}

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

.success {
  color: var(--green);
}

.warning {
  color: var(--amber);
}

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

.info {
  color: var(--blue);
}

.dim {
  color: #65806a;
}

.title {
  color: var(--white);
  background: #103a1b;
  display: inline;
}

.terminal-image-wrap {
  width: min(760px, 96%);
  margin: 8px 0 14px;
  border: 1px solid rgba(24, 214, 86, 0.36);
  background: #020402;
  overflow: hidden;
  position: relative;
}

.terminal-image-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(0deg, rgba(24, 214, 86, 0.08), rgba(24, 214, 86, 0.08) 1px, transparent 1px, transparent 5px);
  mix-blend-mode: screen;
  pointer-events: none;
}

.terminal-image {
  display: block;
  width: 100%;
  height: auto;
  filter: contrast(1.04) saturate(0.9);
}

.terminal-image-wrap.loading .terminal-image {
  opacity: 0;
}

.post-body {
  max-width: 980px;
}

.post-body p {
  margin: 0 0 1em;
}

.post-body h1,
.post-body h2,
.post-body h3,
.post-body h4 {
  color: var(--green);
  font-weight: 400;
  margin: 1em 0 0.35em;
}

.post-body a {
  color: var(--blue);
}

.post-body blockquote {
  border-left: 2px solid rgba(24, 214, 86, 0.5);
  margin: 0.6em 0;
  padding-left: 1em;
  color: #cde7ce;
}

.post-body img,
.inline-img {
  display: block;
  max-width: min(760px, 96%);
  height: auto;
  margin: 10px 0;
  border: 1px solid rgba(24, 214, 86, 0.32);
}

.cursor::after {
  content: "█";
  display: inline-block;
  color: var(--green);
  animation: blink 0.9s steps(1, end) infinite;
}

@keyframes scanline {
  from {
    top: -120px;
  }
  to {
    top: 100vh;
  }
}

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

@media (max-width: 720px) {
  #terminal {
    min-height: 100svh;
    padding: 9px;
  }

  #output {
    font-size: 18px;
    line-height: 1.15;
  }

  #prompt,
  #terminal-input {
    font-size: 21px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scan-line,
  .cursor::after {
    animation: none;
  }
}
