:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  --bg: #f5f3ee;
  --ink: #1d1d1b;
  --muted: #69645b;
  --line: #d7d0c2;
  --panel: #fffdf8;
  --panel-strong: #f0eee6;
  --accent: #1f7a5a;
  --accent-dark: #15553f;
  --warn: #aa5e16;
  --error: #a13d32;
  --shadow: 0 18px 48px rgba(58, 47, 28, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(31, 122, 90, 0.08), transparent 38%),
    var(--bg);
  color: var(--ink);
}

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

button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 0 14px;
  cursor: pointer;
}

button:hover {
  border-color: #b7aa92;
  background: #faf7ef;
}

button:disabled {
  cursor: progress;
  opacity: 0.62;
}

button.active {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

.primary:hover {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
}

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

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.1;
  letter-spacing: 0;
}

p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.runtime-field,
.docs-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.credit-note {
  display: block;
  border: 1px solid rgba(31, 122, 90, 0.32);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  background: #f1faf5;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.48;
  padding: 12px 14px;
  margin-bottom: 16px;
  box-shadow: 0 10px 28px rgba(31, 122, 90, 0.08);
}

.credit-note a,
.docs a {
  color: var(--accent-dark);
  font-weight: 650;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.number-field,
.runtime-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.number-field input {
  width: 92px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 0 10px;
  color: var(--ink);
}

.runtime-field select {
  min-width: 220px;
}

select {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 0 36px 0 10px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(340px, 0.92fr);
  gap: 16px;
  min-height: calc(100vh - 170px);
}

.tiny-pane {
  min-height: 0;
  margin-bottom: 16px;
}

.engine-pane {
  min-height: 0;
  margin-bottom: 16px;
}

.synth-heading,
.synth-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.synth-actions {
  justify-content: flex-end;
}

.dialect-help {
  border-bottom: 1px solid var(--line);
  margin: 0;
  background: #fbfaf5;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  padding: 9px 12px;
}

.tiny-body {
  display: grid;
  grid-template-columns: minmax(300px, 1.1fr) minmax(260px, 0.9fr) minmax(260px, 1fr);
  gap: 14px;
  padding: 14px;
}

.engine-body {
  display: grid;
  grid-template-columns: minmax(300px, 0.95fr) minmax(300px, 1.05fr);
  gap: 14px;
  padding: 14px;
}

.tiny-spec > span,
.synth-section-title {
  min-height: 34px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: #faf8f1;
  color: var(--muted);
  font-size: 13px;
  padding: 0 10px;
}

.tiny-spec {
  display: flex;
  min-width: 0;
  min-height: 250px;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.tiny-spec textarea {
  min-height: 0;
  padding: 10px;
}

.tiny-summary,
.tiny-found,
.engine-summary,
.engine-demo {
  min-width: 0;
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.tiny-summary pre,
.tiny-found pre {
  min-height: 216px;
  max-height: 270px;
  font-size: 13px;
}

.engine-summary pre,
.engine-demo pre {
  min-height: 168px;
  max-height: 240px;
  font-size: 13px;
}

.compact-number input {
  width: 68px;
}

.docs-pane {
  min-height: 360px;
  margin-top: 16px;
}

.docs-heading {
  flex-wrap: wrap;
}

.docs-tabs button {
  min-height: 30px;
  padding: 0 10px;
}

.pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 460px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.pane.engine-pane {
  min-height: 280px;
}

.pane > span,
.pane-heading {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  background: #faf8f1;
  padding: 0 12px;
  color: var(--muted);
  font-size: 14px;
}

.pane-heading button {
  min-height: 30px;
  padding: 0 10px;
}

.pane-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

textarea,
pre {
  flex: 1;
  width: 100%;
  margin: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 14px;
  line-height: 1.55;
}

textarea {
  resize: none;
  padding: 14px;
}

pre {
  white-space: pre-wrap;
  overflow: auto;
  padding: 14px;
}

.docs {
  overflow: auto;
  padding: 18px 22px 24px;
  line-height: 1.56;
}

.docs h1,
.docs h2,
.docs h3 {
  margin: 18px 0 8px;
  line-height: 1.2;
  letter-spacing: 0;
}

.docs h1 {
  margin-top: 0;
  font-size: 22px;
}

.docs h2 {
  font-size: 17px;
}

.docs h3 {
  font-size: 15px;
}

.docs p,
.docs li {
  font-size: 14px;
}

.docs p {
  margin: 8px 0;
  color: var(--ink);
}

.docs ul,
.docs ol {
  margin: 8px 0 12px 20px;
  padding: 0;
}

.docs pre {
  min-height: 0;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f2e9;
  padding: 12px;
  margin: 10px 0 14px;
  overflow: auto;
}

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

.docs p code,
.docs li code {
  border: 1px solid #e5dccb;
  border-radius: 5px;
  background: #f6f2e9;
  padding: 1px 4px;
}

@media (max-width: 820px) {
  .shell {
    width: min(100vw - 20px, 720px);
    padding-top: 14px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .runtime-field {
    justify-content: space-between;
  }

  .workspace {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .tiny-body {
    grid-template-columns: 1fr;
  }

  .engine-body {
    grid-template-columns: 1fr;
  }

  .pane {
    min-height: 360px;
  }
}
