:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f4f5f2;
  color: #1c2621;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  overflow: hidden;
}

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

.shell {
  height: 100vh;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid #cfd7cf;
  background: #ffffff;
}

h1,
h2 {
  margin: 0;
  font-weight: 650;
}

h1 {
  font-size: 20px;
}

h2,
.panel > span,
.terminal-panel label span {
  font-size: 13px;
  color: #516058;
}

.tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid #d9e0da;
  padding-bottom: 8px;
}

.tab {
  min-height: 30px;
  border-color: transparent;
  background: transparent;
  color: #516058;
}

.tab.active {
  border-color: #9bac9f;
  background: #edf2ee;
  color: #172019;
}

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

button,
select,
input {
  min-height: 34px;
  border: 1px solid #b9c3bb;
  border-radius: 6px;
  background: #ffffff;
  color: #1c2621;
  padding: 0 10px;
}

button {
  cursor: pointer;
}

button:hover {
  background: #edf2ee;
}

.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(360px, 1.1fr) minmax(320px, 0.9fr);
  grid-template-rows: minmax(260px, 1fr) minmax(220px, 0.8fr);
  gap: 12px;
  padding: 12px;
  min-height: 0;
  overflow: hidden;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #cfd7cf;
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

.editor-panel {
  grid-row: span 2;
}

.output-panel {
  min-height: 0;
}

textarea,
pre {
  width: 100%;
  flex: 1;
  min-height: 0;
  height: 100%;
  margin: 0;
  border: 1px solid #d9e0da;
  border-radius: 6px;
  background: #fbfcfa;
  color: #172019;
  padding: 12px;
  overflow: auto;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

textarea {
  resize: none;
}

.terminal-panel label {
  display: grid;
  grid-template-columns: 48px 1fr;
  align-items: center;
  gap: 8px;
}

#terminalOutput {
  background: #172019;
  color: #eaf2eb;
}

.docs-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 30;
  width: min(620px, 42vw);
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-left: 1px solid #b9c3bb;
  background: #ffffff;
  box-shadow: -18px 0 40px rgba(23, 32, 25, 0.18);
  transform: translateX(100%);
  transition: transform 160ms ease-out;
}

.docs-drawer.open {
  transform: translateX(0);
}

.docs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid #d9e0da;
}

.docs-content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 18px 22px 28px;
  color: #1c2621;
  line-height: 1.55;
}

.docs-content h1,
.docs-content h2,
.docs-content h3 {
  color: #172019;
}

.docs-content h1 {
  font-size: 28px;
  margin: 0 0 18px;
}

.docs-content h2 {
  font-size: 20px;
  margin: 26px 0 10px;
}

.docs-content h3 {
  font-size: 16px;
  margin: 20px 0 8px;
}

.docs-content p,
.docs-content ul,
.docs-content ol {
  margin: 0 0 12px;
}

.docs-content pre {
  display: block;
  height: auto;
  max-height: 360px;
  margin: 0 0 14px;
  flex: none;
  white-space: pre;
}

.docs-content code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.95em;
}

.docs-content :not(pre) > code {
  border: 1px solid #d9e0da;
  border-radius: 4px;
  background: #f4f7f4;
  padding: 1px 4px;
}

.docs-content a {
  color: #23614b;
}

@media (max-width: 860px) {
  body {
    overflow: auto;
  }

  .shell {
    height: auto;
    min-height: 100vh;
  }

  .docs-drawer {
    width: min(92vw, 620px);
  }

  .toolbar,
  .controls {
    align-items: stretch;
    flex-direction: column;
  }

  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(3, minmax(220px, 45vh));
    overflow: visible;
  }

  .editor-panel {
    grid-row: auto;
  }
}
