:root {
  color-scheme: dark;
  --bg: #0b0f14;
  --panel: rgba(15, 20, 28, 0.92);
  --panel-border: rgba(255, 255, 255, 0.06);
  --text: #d7dde5;
  --text-dim: #8b95a7;
  --accent: #7ee787;
  --accent-alt: #79c0ff;
  --error: #ff6b6b;
  --error-dim: rgba(255, 107, 107, 0.7);
  --warning: #f2cc60;
  --selection: rgba(121, 192, 255, 0.28);
  --cursor: rgba(215, 221, 229, 0.92);
  --cursor-width: 0.6em;
  --cursor-radius: 2px;
  --glow: rgba(110, 255, 180, 0.12);
  --scanline: rgba(255, 255, 255, 0.03);
  --noise: rgba(255, 255, 255, 0.02);
  --vignette: rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;
  font-size: 14px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow: hidden;
}

body.shell--bash {
  --accent: #79c0ff;
  --cursor-width: 2px;
  --cursor-radius: 1px;
}

body.shell--powershell {
  --accent: #7ee787;
}

body.reduced-effects .terminal::after,
body.reduced-effects .terminal::before,
body.reduced-effects::before {
  animation: none;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 20% 20%, transparent 30%, var(--vignette) 70%),
    radial-gradient(circle at 80% 80%, transparent 35%, var(--vignette) 75%);
  mix-blend-mode: multiply;
  opacity: 0.7;
  z-index: 0;
}

::selection {
  background: var(--selection);
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: relative;
  z-index: 1;
}

.shell-bar {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: rgba(10, 14, 20, 0.96);
  border-bottom: 1px solid var(--panel-border);
}

.shell-select {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}

.shell-select select {
  background: var(--panel);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 13px;
}

.shell-indicators {
  display: flex;
  gap: 16px;
  font-size: 11px;
  color: var(--text-dim);
  opacity: 0.8;
}

.terminal {
  flex: 1;
  position: relative;
  padding: 16px;
}

.terminal::before {
  content: "";
  position: absolute;
  inset: 16px;
  background: repeating-linear-gradient(
    to bottom,
    var(--scanline),
    var(--scanline) 1px,
    transparent 1px,
    transparent 3px
  );
  opacity: 0.5;
  pointer-events: none;
  z-index: 1;
}

.terminal::after {
  content: "";
  position: absolute;
  inset: 16px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/></filter><rect width='120' height='120' filter='url(%23n)' opacity='0.45'/></svg>");
  opacity: 0.08;
  mix-blend-mode: screen;
  pointer-events: none;
  animation: noiseShift 8s linear infinite;
  z-index: 2;
}

@keyframes noiseShift {
  0% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(-10px, 6px);
  }
  100% {
    transform: translate(0, 0);
  }
}

.terminal__viewport {
  position: relative;
  z-index: 3;
  height: 100%;
  border: 1px solid var(--panel-border);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
  border-radius: 10px;
  padding: 16px;
  background: rgba(7, 11, 16, 0.96);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-shadow: 0 0 6px var(--glow);
}

.output {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 auto;
  min-height: 0;
}

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

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

.line--prompt {
  color: var(--text);
}

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

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

.line--humor {
  color: var(--text-dim);
  font-style: italic;
}

.line--help {
  color: var(--text);
}

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

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

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

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

.input-line {
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.input-line.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.prompt {
  white-space: pre;
}

.input-wrap {
  position: relative;
  flex: 1 1 auto;
  min-width: 16px;
}

#cmdInput {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  outline: none;
  caret-color: transparent;
}

.input-measure {
  position: absolute;
  top: 0;
  left: 0;
  visibility: hidden;
  white-space: pre;
  font: inherit;
}

.cursor {
  position: absolute;
  top: 2px;
  left: 0;
  width: var(--cursor-width);
  height: 1.05em;
  background: var(--cursor);
  border-radius: var(--cursor-radius);
  animation: blink 1.06s steps(1) infinite;
  transform: translateX(0);
}

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

@keyframes blink {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}

.new-output {
  position: absolute;
  right: 16px;
  bottom: 16px;
  padding: 6px 10px;
  background: rgba(18, 26, 38, 0.96);
  border: 1px solid rgba(121, 192, 255, 0.25);
  color: var(--accent-alt);
  border-radius: 999px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  align-self: flex-end;
}

.new-output.is-visible {
  opacity: 0.9;
  pointer-events: auto;
}

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

  .terminal {
    padding: 12px;
  }

  .terminal__viewport {
    padding: 12px;
  }

  .shell-indicators {
    display: none;
  }
}

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

  .terminal::after {
    animation: none;
  }
}
