:root {
  --font-mono: "Consolas", "Lucida Console", "Courier New", monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, sans-serif;
}

body.theme-black {
  background: #0a0a0a;
  color: #33ff66;
}

body.theme-color {
  background: #d8d8d8;
  color: #111;
}

.layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.25rem 2rem;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

h1 {
  font-size: 1.15rem;
  margin: 0 0 0.25rem;
}

.sub {
  margin: 0;
  opacity: 0.85;
  font-size: 0.85rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

button,
.btn {
  font: inherit;
  cursor: pointer;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  padding: 0.35rem 0.65rem;
  border-radius: 4px;
  text-decoration: none;
  font-size: 0.85rem;
}

button.active {
  font-weight: 700;
}

.card {
  border: 1px solid currentColor;
  border-radius: 6px;
  padding: 0.75rem;
  margin-bottom: 1rem;
}

.params {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.75rem;
}

.params label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.params input {
  font: inherit;
  padding: 0.35rem 0.5rem;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  border-radius: 4px;
}

.main {
  display: grid;
  grid-template-columns: 1fr min(22rem, 100%);
  gap: 1rem;
}

body.doc-view .layout {
  max-width: 960px;
}

body.doc-view .toolbar,
body.doc-view .params,
body.doc-view .side {
  display: none;
}

body.doc-view .main {
  grid-template-columns: 1fr;
}

body.doc-view .screen-wrap {
  margin-top: 0.25rem;
}

body.doc-view .terminal {
  min-height: 40rem;
  max-height: none;
  font-size: 0.82rem;
  line-height: 1.45;
}

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

.terminal {
  margin: 0;
  min-height: 28rem;
  max-height: 70vh;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
}

body.theme-black .terminal {
  background: #000;
  color: #33ff66;
  padding: 1rem;
}

body.theme-color .terminal {
  background: #dcdcdc;
  color: #111;
  padding: 1rem;
}

body.theme-color .card,
body.theme-color button,
body.theme-color .btn,
body.theme-color .params input,
body.theme-color .alchemy-row input {
  border-color: #444;
}

body.theme-color .sub,
body.theme-color footer {
  color: #222;
}

.side h2 {
  font-size: 0.85rem;
  margin: 0 0 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cmd-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.alchemy-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.75rem;
  margin-bottom: 0.75rem;
}

.alchemy-row input {
  font: inherit;
  padding: 0.35rem;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  border-radius: 4px;
}

.json-out {
  margin: 0;
  max-height: 16rem;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  white-space: pre-wrap;
  word-break: break-word;
  opacity: 0.9;
}

footer {
  font-size: 0.75rem;
  opacity: 0.8;
}

footer code {
  font-family: var(--font-mono);
}
