:root {
  color-scheme: light;
  --bg: #f6f7f3;
  --ink: #17211c;
  --muted: #637068;
  --line: #d8ded6;
  --panel: #ffffff;
  --accent: #176b87;
  --accent-strong: #0f5168;
  --danger: #a33636;
  --soft: #eef5f4;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(140deg, rgba(23, 107, 135, 0.09), transparent 34%),
    linear-gradient(18deg, rgba(118, 150, 86, 0.12), transparent 38%),
    var(--bg);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

.shell {
  display: grid;
  grid-template-columns: minmax(320px, 0.78fr) minmax(360px, 1fr);
  gap: 20px;
  width: min(1180px, calc(100% - 32px));
  margin: 32px auto;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 22px 50px rgba(28, 39, 34, 0.08);
}

.input-panel,
.output-panel {
  padding: 24px;
}

.brand-row,
.output-header,
.button-row,
.grid-two,
.toggle-row {
  display: flex;
  align-items: center;
}

.brand-row,
.output-header {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.grid-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.75rem);
  line-height: 0.96;
}

h2 {
  font-size: 1.35rem;
}

.status-pill {
  min-width: 76px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--soft);
  color: var(--accent-strong);
  font-size: 0.88rem;
  font-weight: 700;
  text-align: center;
}

.status-pill.error {
  background: #fff0f0;
  color: var(--danger);
}

.form {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 107, 135, 0.14);
}

.toggle-row {
  grid-template-columns: auto 1fr;
  align-self: end;
  min-height: 46px;
  padding: 0 4px;
}

.toggle-row input {
  width: 18px;
  height: 18px;
}

.llm-fields {
  display: grid;
  gap: 14px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfa;
}

.llm-fields:disabled {
  opacity: 0.58;
}

button {
  border: 0;
  border-radius: 8px;
  padding: 12px 16px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.button-row {
  gap: 10px;
}

.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.secondary:hover {
  background: var(--soft);
}

#output {
  min-height: 560px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.92rem;
  line-height: 1.55;
}

.summary {
  min-height: 24px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.92rem;
}

.error-details {
  margin-top: 14px;
  border: 1px solid #efc7c7;
  border-radius: 8px;
  background: #fff8f8;
  color: var(--danger);
}

.error-details summary {
  cursor: pointer;
  padding: 12px 14px;
  font-weight: 800;
}

.error-details pre {
  max-height: 320px;
  margin: 0;
  overflow: auto;
  border-top: 1px solid #efc7c7;
  padding: 14px;
  color: #4b1f1f;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.82rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.guide {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto 36px;
}

.guide-inner {
  border-top: 1px solid var(--line);
  padding-top: 28px;
}

.guide h2 {
  margin-bottom: 18px;
  font-size: 1.65rem;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 28px;
}

.guide section {
  min-width: 0;
}

.guide h3 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 1rem;
}

.guide p,
.guide li {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.75;
}

.guide p {
  margin: 0 0 10px;
}

.guide ol {
  margin: 0;
  padding-left: 1.25rem;
}

.guide li + li {
  margin-top: 6px;
}

@media (max-width: 880px) {
  .shell {
    grid-template-columns: 1fr;
    margin: 18px auto;
  }

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

  #output {
    min-height: 420px;
  }

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