* {
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
  --bg: #0d1117;
  --panel: #090e13;
  --titlebar: #161b22;
  --border: #30363d;
  --border-soft: #242c35;
  --text: #e6edf3;
  --muted: #8b949e;
  --green: #3fb950;
  --green-bright: #56d364;
  --blue: #58a6ff;
  --yellow: #e3b341;
  --red: #f85149;
  --purple: #bc8cff;
  --cyan: #39c5cf;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 50% -10%, rgba(63, 185, 80, 0.06), transparent 34%),
    var(--bg);
  color: var(--text);
}

body {
  min-height: 100vh;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

button,
input,
textarea,
select {
  font: inherit;
}

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

.ascii-window {
  overflow: hidden;
  background: var(--panel);
  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;
}

.ascii-titlebar {
  height: 48px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: var(--titlebar);
  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 {
  text-decoration: none;
  cursor: pointer;
}

.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);
}

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

.ascii-status {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--green);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px rgba(63,185,80,0.45);
}

.ascii-console {
  padding: 18px;
  background:
    linear-gradient(rgba(5,9,13,0.97), rgba(5,9,13,0.97)),
    repeating-linear-gradient(
      0deg,
      transparent 0 25px,
      rgba(255,255,255,0.012) 25px 26px
    );
}

.console-command {
  margin-bottom: 13px;
  color: #c9d1d9;
  font-size: 0.8rem;
}

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

.mode-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 13px;
}

.mode-tab {
  min-height: 38px;
  padding: 7px 11px;
  color: #8f99a3;
  background: #10161d;
  border: 1px solid #2a323b;
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.68rem;
}

.mode-tab.active {
  color: #dfffe6;
  border-color: #347d45;
  background: rgba(63,185,80,0.10);
}

.lab-grid {
  display: grid;
  grid-template-columns: minmax(290px, 0.75fr) minmax(0, 1.55fr);
  gap: 13px;
}

.controls-panel,
.output-panel {
  min-width: 0;
  background: rgba(13,19,26,0.90);
  border: 1px solid var(--border-soft);
  border-radius: 9px;
}

.controls-panel {
  padding: 14px;
}

.mode-panel {
  display: none;
}

.mode-panel.active {
  display: block;
}

.field-label,
.range-field,
.control-row label {
  color: #8b949e;
  font-size: 0.69rem;
}

.field-label {
  display: block;
  margin: 0 0 6px;
}

.text-input,
.text-area,
select,
input[type="number"] {
  width: 100%;
  color: #d8e0e7;
  background: #090e13;
  border: 1px solid #2d3640;
  border-radius: 6px;
  outline: none;
}

.text-input,
select,
input[type="number"] {
  min-height: 40px;
  padding: 7px 9px;
}

.text-area {
  resize: vertical;
  padding: 9px;
  line-height: 1.5;
}

.text-input:focus,
.text-area:focus,
select:focus,
input[type="number"]:focus {
  border-color: #3f8950;
}

.control-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 11px;
}

.control-row label {
  display: grid;
  gap: 6px;
}

.check-row,
.check-inline {
  display: flex !important;
  align-items: center;
  gap: 8px !important;
}

.check-row {
  margin-top: 12px;
  color: #9aa4af;
  font-size: 0.72rem;
}

.range-field {
  display: grid;
  grid-template-columns: auto minmax(0,1fr) 40px;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.range-field input {
  width: 100%;
}

.action-button {
  width: 100%;
  min-height: 42px;
  margin-top: 14px;
  color: #dfffe6;
  background: rgba(63,185,80,0.10);
  border: 1px solid #347d45;
  border-radius: 7px;
  cursor: pointer;
}

.action-button:hover,
.action-button:focus-visible {
  background: rgba(63,185,80,0.16);
  outline: none;
}

.upload-box {
  display: grid;
  gap: 6px;
  padding: 18px;
  color: #86909a;
  background: #090e13;
  border: 1px dashed #35414b;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.7rem;
  text-align: center;
}

.upload-title {
  color: #d3dbe3;
  font-size: 0.82rem;
  font-weight: 700;
}

.upload-box input {
  margin: 8px auto 0;
  max-width: 100%;
}

.privacy-note {
  margin: 10px 0 0;
  color: #69737d;
  font-size: 0.64rem;
  line-height: 1.5;
}

.full-select {
  margin-bottom: 11px;
}

.progress-controls.hidden,
.hidden-canvas {
  display: none;
}

.output-panel {
  display: flex;
  flex-direction: column;
  min-height: 580px;
  overflow: hidden;
}

.output-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 11px 13px;
  background: #10161d;
  border-bottom: 1px solid #242c35;
}

.output-label {
  color: #7d8791;
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.output-meta {
  margin-left: 8px;
  color: #56616b;
  font-size: 0.62rem;
}

.output-actions {
  display: flex;
  gap: 7px;
}

.output-actions button,
.example-strip button {
  min-height: 34px;
  padding: 5px 9px;
  color: #9da7b1;
  background: #0c1218;
  border: 1px solid #2d3640;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.65rem;
}

.output-actions button:hover,
.example-strip button:hover {
  color: var(--green-bright);
  border-color: #347d45;
}

.ascii-output {
  flex: 1 1 auto;
  min-height: 500px;
  margin: 0;
  overflow: auto;
  padding: 16px;
  color: #d8e0e7;
  background: #020503;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.15;
  white-space: pre;
  tab-size: 2;
}

.ascii-output.green {
  color: #56d364;
}

.ascii-output.amber {
  color: #e3b341;
}

.ascii-output.colorized {
  color: inherit;
}

.example-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 10px 12px;
  background: #0b1016;
  border-top: 1px solid #202832;
}

.status-line {
  margin-top: 11px;
  color: #68727c;
  font-size: 0.68rem;
  text-align: center;
}

.ascii-note {
  margin: 12px 0 0;
  color: #6e7681;
  font-size: 0.7rem;
  line-height: 1.5;
  text-align: center;
}

@media (max-width: 900px) {
  .lab-grid {
    grid-template-columns: 1fr;
  }

  .output-panel {
    min-height: 480px;
  }

  .ascii-output {
    min-height: 400px;
  }
}

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

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

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

  .ascii-console {
    padding: 11px;
  }

  .control-row {
    grid-template-columns: 1fr;
  }

  .hud {
    grid-template-columns: 1fr;
  }
}


/* RunsLinux shared Labs workstation shell */
@media (min-width: 901px) {
  html, body { width: 100%; height: 100%; overflow: hidden; }
  body.rl-has-site-nav { background: #080d13; }
  .ascii-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;
  }
  .ascii-shell > .ascii-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;
  }
  .ascii-shell > :not(.ascii-window) { display: none !important; }
}

/* Workstation fit pass v1.1: keep ASCII Lab controls/output inside the monitor. */
@media (min-width: 901px) {
  .ascii-shell > .ascii-window { overflow: hidden !important; display: flex !important; flex-direction: column !important; }
  .ascii-titlebar { flex: 0 0 42px !important; height: 42px !important; }
  .ascii-console { flex: 1 1 auto !important; min-height: 0 !important; height: auto !important; overflow: auto !important; padding: 10px 12px 12px !important; }
  .lab-grid { min-height: 0 !important; gap: 10px !important; }
  .output-panel { min-height: 0 !important; }
  .mode-panel { min-height: 0 !important; }
  .text-area { min-height: 90px !important; }
}
