* {
  box-sizing: border-box;
}

:root {
  color-scheme: dark;

  --bg: #0d1117;
  --panel: #0b1016;
  --panel-2: #161b22;
  --border: #30363d;

  --text: #e6edf3;
  --muted: #8b949e;

  --node: #6cc24a;
  --node-soft: rgba(108, 194, 74, 0.13);
  --blue: #58a6ff;
  --yellow: #e3b341;
  --red: #f85149;
  --purple: #bc8cff;
  --cyan: #39c5cf;
}

html,
body {
  margin: 0;
  min-height: 100%;

  background:
    radial-gradient(circle at 50% -10%, rgba(108, 194, 74, 0.07), transparent 34%),
    var(--bg);

  color: var(--text);
}

body {
  min-height: 100vh;

  font-family:
    "SFMono-Regular",
    Consolas,
    "Liberation Mono",
    Menlo,
    monospace;
}

button,
input {
  font: inherit;
}

.node-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 30px 0 24px;
}

.node-window {
  min-height: 78vh;
  overflow: hidden;

  background:
    linear-gradient(rgba(11, 16, 22, 0.96), rgba(11, 16, 22, 0.96)),
    repeating-linear-gradient(
      0deg,
      transparent 0 25px,
      rgba(255, 255, 255, 0.012) 25px 26px
    );

  border: 1px solid var(--border);
  border-radius: 14px;

  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.42),
    0 0 0 1px rgba(255, 255, 255, 0.015) inset;
}

.node-titlebar {
  height: 48px;

  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;

  padding: 0 16px;

  background: var(--panel-2);
  border-bottom: 1px solid #252d36;
}

.window-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.window-dot {
  width: 12px;
  height: 12px;

  display: inline-block;

  border: 0;
  border-radius: 50%;
}

a.window-dot {
  cursor: pointer;
  text-decoration: none;
}

.window-dot.red {
  background: #ff5f57;
}

.window-dot.yellow {
  background: #febc2e;
}

.window-dot.green {
  background: #28c840;
}

a.window-dot.red:hover,
a.window-dot.red:focus-visible {
  outline: 2px solid rgba(255, 95, 87, 0.35);
  outline-offset: 3px;
  transform: scale(1.08);
}

.node-title {
  color: #9aa4af;
  font-size: 0.78rem;
  text-align: center;
}

.node-runtime {
  justify-self: end;

  display: flex;
  align-items: center;
  gap: 7px;

  color: var(--node);

  font-size: 0.7rem;
  font-weight: 700;
}

.runtime-dot {
  width: 7px;
  height: 7px;

  border-radius: 50%;

  background: var(--node);
  box-shadow: 0 0 10px rgba(108, 194, 74, 0.45);
}

.node-console {
  min-height: calc(78vh - 48px);

  display: flex;
  flex-direction: column;
}

.node-output {
  flex: 1 1 auto;

  min-height: 0;
  max-height: calc(100vh - 165px);
  overflow-y: auto;

  padding: 22px 24px 10px;

  scrollbar-width: thin;
  scrollbar-color: #30363d transparent;
}

.node-output::-webkit-scrollbar {
  width: 10px;
}

.node-output::-webkit-scrollbar-thumb {
  background: #30363d;
  border-radius: 999px;
}

.output-line {
  margin: 0 0 4px;

  white-space: pre-wrap;
  overflow-wrap: anywhere;

  color: #c9d1d9;

  font-size: clamp(0.78rem, 1.1vw, 0.92rem);
  line-height: 1.55;
}

.output-line.command {
  margin-top: 11px;
  color: #f0f6fc;
}

.output-line.muted {
  color: var(--muted);
}

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

.output-line.blue {
  color: var(--blue);
}

.output-line.yellow {
  color: var(--yellow);
}

.output-line.red {
  color: var(--red);
}

.output-line.purple {
  color: var(--purple);
}

.output-line.cyan {
  color: var(--cyan);
}

.output-line.bold {
  color: #f0f6fc;
  font-weight: 700;
}

.object-block {
  margin: 7px 0 11px;
  padding-left: 4px;

  white-space: pre-wrap;
  overflow-wrap: anywhere;

  color: #c9d1d9;

  font-size: clamp(0.76rem, 1vw, 0.9rem);
  line-height: 1.48;
}

.syntax-key {
  color: var(--cyan);
}

.syntax-string {
  color: #a5d6ff;
}

.syntax-number {
  color: #d2a8ff;
}

.syntax-boolean {
  color: var(--yellow);
}

.syntax-null {
  color: var(--red);
}

.node-input-row {
  display: flex;
  align-items: center;
  gap: 10px;

  min-height: 50px;

  padding: 8px 24px 14px;
}

.node-prompt {
  flex: 0 0 auto;

  color: var(--node);

  font-size: clamp(0.78rem, 1.1vw, 0.92rem);
}

.node-input {
  flex: 1 1 auto;
  min-width: 0;

  padding: 0;

  background: transparent;
  color: #f0f6fc;

  border: 0;
  outline: 0;

  caret-color: var(--node);

  font-size: clamp(0.78rem, 1.1vw, 0.92rem);
}

.node-hint {
  margin-top: 12px;

  color: #6e7681;

  font-size: 0.72rem;
  text-align: center;
}

.node-hint code {
  color: #9aa4af;
}

@media (max-width: 650px) {
  .node-shell {
    width: min(100% - 18px, 1180px);
    padding-top: 12px;
  }

  .node-titlebar {
    padding: 0 10px;
  }

  .node-title {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .node-output {
    max-height: calc(100vh - 145px);
    padding: 16px 14px 8px;
  }

  .node-input-row {
    padding: 8px 14px 12px;
  }
}


/* RunsLinux shared Labs workstation shell */
@media (min-width: 901px) {
  html, body { width: 100%; height: 100%; overflow: hidden; }
  body.rl-has-site-nav { background: #080d13; }
  .node-shell {
    position: relative !important;
    width: 100vw !important;
    max-width: none !important;
    height: calc(100vh - 54px) !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    background: url('/assets/terminal-workstation.webp') center top / cover no-repeat !important;
  }
  .node-shell > .node-window {
    position: absolute !important;
    left: 19.65% !important;
    top: 5.75% !important;
    width: 62.75% !important;
    height: 60.45% !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    overflow: auto !important;
    border-radius: 10px !important;
    z-index: 3 !important;
    box-shadow: none !important;
  }
  .node-shell > :not(.node-window) { display: none !important; }
}

/* Workstation fit pass v1.1: keep the complete Node REPL inside the monitor. */
@media (min-width: 901px) {
  .node-shell > .node-window { overflow: hidden !important; display: flex !important; flex-direction: column !important; }
  .node-titlebar { flex: 0 0 42px !important; height: 42px !important; }
  .node-console { flex: 1 1 auto !important; min-height: 0 !important; height: auto !important; overflow: hidden !important; display: flex !important; flex-direction: column !important; }
  .node-output { flex: 1 1 auto !important; min-height: 0 !important; max-height: none !important; overflow-y: auto !important; padding: 14px 18px 8px !important; }
  .node-input-row { flex: 0 0 44px !important; min-height: 44px !important; }
  .output-line { font-size: clamp(.66rem, .72vw, .82rem) !important; line-height: 1.4 !important; }
  .node-hint { display: none !important; }
}
