:root {
  color-scheme: dark;
  --text: #b9d1a2;
  --muted: #7d9670;
  --accent: #74f885;
  --line: #1b2a1f;
  --warn: #ffd166;
  --link: #9ac8ff;
  --error: #ff8f8f;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #05070c;
  color: var(--text);
  font-family: "JetBrains Mono", "Fira Code", "Source Code Pro", "Noto Sans JP", monospace;
  line-height: 1.65;
  letter-spacing: 0.01em;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    180deg,
    rgba(120, 255, 144, 0.045) 0,
    rgba(120, 255, 144, 0.045) 1px,
    transparent 1px,
    transparent 3px
  );
  mix-blend-mode: screen;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(116, 248, 133, 0.03) 48%,
    transparent 100%
  );
  animation: terminal-sweep 7s linear infinite;
}

@keyframes terminal-sweep {
  from {
    transform: translateY(-100%);
  }
  to {
    transform: translateY(100%);
  }
}

.terminal-screen {
  width: min(1120px, calc(100% - 32px));
  min-height: calc(100vh - 44px);
  margin: 22px auto;
  padding: 16px 16px 14px;
  border: 1px solid var(--line);
  background: radial-gradient(circle at 15% 0%, rgba(51, 82, 56, 0.2) 0%, transparent 34%), #05070c;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.terminal-log {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}

.terminal-screen.terminal-cleared .terminal-log {
  flex: 0 0 auto;
  min-height: 0;
}

.terminal-log::-webkit-scrollbar {
  width: 8px;
}

.terminal-log::-webkit-scrollbar-thumb {
  background: #1a2a1f;
}

.entry {
  margin: 0 0 10px;
}

.line {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.prompt {
  color: var(--accent);
  font-weight: 700;
}

.command {
  color: var(--warn);
}

.output {
  margin: 6px 0 0 2ch;
  color: var(--text);
}

.output-pre {
  margin: 0;
  white-space: pre-wrap;
}

.summary-linked-output {
  white-space: pre;
  overflow-x: auto;
  word-break: normal;
}

.summary-linked-output a {
  white-space: pre;
}

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

.terminal-form {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.terminal-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.terminal-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  letter-spacing: inherit;
  caret-color: var(--accent);
}

a {
  color: var(--link);
  text-underline-offset: 0.2em;
}

a:hover {
  color: #b4d2ff;
}

@media (max-width: 860px) {
  .terminal-screen {
    width: calc(100% - 16px);
    margin: 8px auto;
    min-height: calc(100vh - 16px);
  }

  .output {
    margin-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  body::after {
    animation: none;
  }
}
