:root {
  color-scheme: dark;
  --bg: #000;
  --panel: #020702;
  --line: #0b4f0b;
  --text: #39ff14;
  --text-soft: #1edb0d;
  --text-dim: #168d0f;
  --black: #000;
  --selection-text: #000;
  --link: #afffaf;
  --scanline: rgba(57, 255, 20, 0.03);
  --shell-core: #041404;
  --bar-bg: #010401;
  --window-ring: rgba(57, 255, 20, 0.12);
  --window-glow: rgba(57, 255, 20, 0.14);
  --text-glow: 0 0 8px rgba(57, 255, 20, 0.35);
  --led-glow: 0 0 12px rgba(57, 255, 20, 0.75);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
}

body {
  overflow: hidden;
  color: var(--text);
  font-family: "Courier New", Courier, monospace;
  font-size: 16px;
  line-height: 1.45;
}

body[data-theme="bright"] {
  --panel: #000;
  --line: #39ff14;
  --text: #c8ffc1;
  --text-soft: #72ff68;
  --text-dim: #4fd947;
  --link: #e4ffe0;
  --scanline: rgba(200, 255, 193, 0.035);
  --shell-core: #061f06;
  --window-ring: rgba(200, 255, 193, 0.16);
  --window-glow: rgba(114, 255, 104, 0.18);
  --text-glow: 0 0 10px rgba(200, 255, 193, 0.45);
  --led-glow: 0 0 14px rgba(200, 255, 193, 0.9);
}

body[data-theme="amber"] {
  --bg: #070401;
  --panel: #120b03;
  --line: #7a4c0a;
  --text: #ffbf3f;
  --text-soft: #ffd06a;
  --text-dim: #b77b23;
  --selection-text: #140900;
  --link: #ffe0a3;
  --scanline: rgba(255, 191, 63, 0.035);
  --shell-core: #211000;
  --bar-bg: #0b0601;
  --window-ring: rgba(255, 191, 63, 0.12);
  --window-glow: rgba(255, 170, 42, 0.17);
  --text-glow: 0 0 8px rgba(255, 191, 63, 0.34);
  --led-glow: 0 0 12px rgba(255, 191, 63, 0.78);
}

body[data-theme="cyan"] {
  --bg: #02070a;
  --panel: #031117;
  --line: #087f8c;
  --text: #62f3ff;
  --text-soft: #2fcad6;
  --text-dim: #288895;
  --selection-text: #001014;
  --link: #b8fbff;
  --scanline: rgba(98, 243, 255, 0.032);
  --shell-core: #06212a;
  --bar-bg: #020b0f;
  --window-ring: rgba(98, 243, 255, 0.12);
  --window-glow: rgba(47, 202, 214, 0.17);
  --text-glow: 0 0 8px rgba(98, 243, 255, 0.32);
  --led-glow: 0 0 12px rgba(98, 243, 255, 0.75);
}

body[data-theme="paper"] {
  color-scheme: light;
  --bg: #f1e8c8;
  --panel: #fff8df;
  --line: #80672f;
  --text: #1d2b24;
  --text-soft: #4d694f;
  --text-dim: #776742;
  --selection-text: #fff8df;
  --link: #125e6d;
  --scanline: rgba(29, 43, 36, 0.035);
  --shell-core: #eadfae;
  --bar-bg: #eadfbd;
  --window-ring: rgba(64, 52, 24, 0.2);
  --window-glow: rgba(58, 47, 19, 0.15);
  --text-glow: none;
  --led-glow: 0 0 9px rgba(29, 43, 36, 0.35);
}

body[data-theme="hotline"] {
  --bg: #09020a;
  --panel: #140416;
  --line: #bb2f7d;
  --text: #ff5eaa;
  --text-soft: #ff9acb;
  --text-dim: #56b8c8;
  --selection-text: #150314;
  --link: #90f0ff;
  --scanline: rgba(255, 94, 170, 0.035);
  --shell-core: #210722;
  --bar-bg: #0e0310;
  --window-ring: rgba(255, 94, 170, 0.14);
  --window-glow: rgba(86, 184, 200, 0.18);
  --text-glow: 0 0 8px rgba(255, 94, 170, 0.35);
  --led-glow: 0 0 12px rgba(255, 94, 170, 0.8);
}

body[data-theme="windows"] {
  --bg: #000;
  --panel: #0c0c0c;
  --line: #5a5a5a;
  --text: #cccccc;
  --text-soft: #f2f2f2;
  --text-dim: #8f8f8f;
  --selection-text: #000;
  --link: #9cdcfe;
  --scanline: rgba(255, 255, 255, 0.012);
  --shell-core: #101010;
  --bar-bg: #1f1f1f;
  --window-ring: rgba(255, 255, 255, 0.08);
  --window-glow: rgba(0, 120, 215, 0.2);
  --text-glow: none;
  --led-glow: none;
}

body[data-shell="windows"] {
  font-family: Consolas, "Lucida Console", "Courier New", monospace;
}

body[data-shell="windows"] .terminal-shell {
  background: #000;
}

body[data-shell="windows"] .terminal-window {
  border-radius: 0;
  box-shadow: 0 0 0 1px var(--window-ring);
}

body[data-shell="windows"] .terminal-bar {
  min-height: 30px;
}

body[data-shell="windows"] .terminal-led {
  border-radius: 0;
}

button,
input {
  font: inherit;
}

.terminal-shell {
  min-height: 100vh;
  padding: clamp(10px, 3vw, 28px);
  background:
    repeating-linear-gradient(
      0deg,
      var(--scanline) 0,
      var(--scanline) 1px,
      transparent 1px,
      transparent 4px
    ),
    radial-gradient(circle at center, var(--shell-core) 0, var(--bg) 68%);
}

.terminal-window {
  display: grid;
  grid-template-rows: auto 1fr;
  width: min(980px, 100%);
  height: calc(100vh - clamp(20px, 6vw, 56px));
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow:
    0 0 0 1px var(--window-ring),
    0 0 28px var(--window-glow);
}

.terminal-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  color: var(--text-dim);
  background: var(--bar-bg);
}

.terminal-led {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text);
  box-shadow: var(--led-glow);
}

.terminal-title,
.terminal-status {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.terminal-status {
  color: var(--text-soft);
}

.terminal-screen {
  position: relative;
  min-height: 0;
  overflow-y: auto;
  padding: clamp(14px, 3vw, 24px);
  text-shadow: var(--text-glow);
}

.terminal-screen::after {
  position: sticky;
  bottom: 0;
  display: block;
  width: 100%;
  height: 22px;
  pointer-events: none;
  content: "";
  background: linear-gradient(transparent, var(--panel));
}

.site-logo {
  width: 100%;
  margin: 0 0 16px;
  overflow-x: auto;
  color: var(--text);
  font-size: clamp(10px, 2vw, 15px);
  line-height: 1.08;
  white-space: pre;
}

.terminal-output {
  min-height: 12rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.line {
  min-height: 1.45em;
}

.line + .line {
  margin-top: 2px;
}

.dim {
  color: var(--text-dim);
}

.bright {
  color: var(--link);
}

.command-button,
.terminal-link {
  display: inline;
  border: 0;
  border-bottom: 1px solid currentColor;
  padding: 0;
  background: transparent;
  color: var(--link);
  cursor: pointer;
  text-decoration: none;
}

.command-button:hover,
.command-button:focus-visible,
.terminal-link:hover,
.terminal-link:focus-visible {
  color: var(--selection-text);
  background: var(--text);
  outline: 0;
  text-shadow: none;
}

.prompt-line {
  display: flex;
  gap: 0.55ch;
  align-items: baseline;
  margin-top: 10px;
}

.prompt-label {
  flex: 0 0 auto;
  color: var(--text-soft);
}

.command-input {
  min-width: 4ch;
  flex: 1 1 auto;
  border: 0;
  outline: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  caret-color: var(--text);
}

.command-input::selection,
.line::selection,
.site-logo::selection {
  background: var(--text);
  color: var(--selection-text);
  text-shadow: none;
}

.noscript-link {
  position: fixed;
  inset: auto 12px 12px;
  margin: 0;
  color: var(--text);
  font-family: "Courier New", Courier, monospace;
}

.noscript-link a {
  color: var(--link);
}

.nano-editor {
  position: fixed;
  inset: clamp(8px, 3vw, 28px);
  z-index: 20;
  display: grid;
  grid-template-rows: auto 1fr auto;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 0 0 1px var(--window-ring), 0 0 28px var(--window-glow);
}

.nano-title,
.nano-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 10px;
  background: var(--text);
  color: var(--selection-text);
  text-shadow: none;
}

.nano-textarea {
  width: 100%;
  min-height: 0;
  resize: none;
  border: 0;
  outline: 0;
  padding: 12px;
  background: var(--panel);
  color: var(--text);
  caret-color: var(--text);
  font: inherit;
  line-height: 1.45;
}

.nano-bar {
  justify-content: flex-start;
}

.nano-bar button {
  border: 0;
  padding: 0 14px 0 0;
  background: transparent;
  color: var(--selection-text);
  cursor: pointer;
}

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

  .terminal-shell {
    padding: 0;
  }

  .terminal-window {
    width: 100%;
    height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .terminal-status {
    display: none;
  }

  .prompt-line {
    align-items: flex-start;
  }

  .prompt-label {
    max-width: none;
  }
}
