:root {
  color-scheme: light;
  --ink: #151515;
  --muted: #62605b;
  --line: #dedbd2;
  --paper: #fbfaf6;
  --panel: #ffffff;
  --accent: #146b5c;
  --accent-strong: #0d4c43;
  --amber: #d6922a;
  --red: #b42318;
  --shadow: 0 18px 60px rgba(42, 38, 30, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background:
    linear-gradient(120deg, rgba(20, 107, 92, 0.08), transparent 34%),
    linear-gradient(245deg, rgba(214, 146, 42, 0.12), transparent 28%),
    var(--paper);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

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

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 0.75fr) minmax(360px, 1.25fr);
  gap: 18px;
  align-items: start;
}

.intro {
  padding: 22px 4px 8px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  max-width: 9ch;
  font-size: clamp(3.2rem, 9vw, 7.4rem);
  line-height: 0.9;
}

h2 {
  font-size: 1.28rem;
}

.lead {
  max-width: 31rem;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.65;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.controls {
  grid-column: 1;
  display: grid;
  gap: 18px;
  padding: 20px;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 750;
}

.field input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 14px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(20, 107, 92, 0.16);
}

.compact input {
  min-height: 42px;
}

.format-choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.format-choice legend {
  grid-column: 1 / -1;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 750;
}

.format-choice label {
  display: flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-weight: 760;
  cursor: pointer;
}

.format-choice input {
  accent-color: var(--accent);
}

.primary-action {
  min-height: 50px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-weight: 850;
  cursor: pointer;
}

.primary-action:hover {
  background: var(--accent-strong);
}

.primary-action:disabled {
  cursor: wait;
  opacity: 0.72;
}

.output {
  grid-column: 2;
  grid-row: 1 / span 2;
  min-height: 680px;
  padding: 20px;
}

.output-head {
  display: flex;
  gap: 18px;
  align-items: start;
  justify-content: space-between;
}

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

.actions button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  font-weight: 760;
  cursor: pointer;
}

.actions button:not(:disabled):hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.actions button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 36px;
  margin: 18px 0;
}

.meta span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  background: #fbfaf6;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 760;
}

.result {
  min-height: 520px;
  max-height: calc(100vh - 250px);
  margin: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #111614;
  color: #eff7f1;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.95rem;
  line-height: 1.7;
  white-space: pre-wrap;
}

.is-error {
  color: var(--red);
}

@media (max-width: 860px) {
  .shell {
    width: min(100vw - 24px, 680px);
    padding: 24px 0;
  }

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

  .controls,
  .output {
    grid-column: 1;
    grid-row: auto;
  }

  .output {
    min-height: auto;
  }

  .output-head {
    flex-direction: column;
  }

  .actions {
    width: 100%;
    justify-content: stretch;
  }

  .actions button {
    flex: 1;
  }

  .result {
    min-height: 420px;
  }
}

@media (max-width: 520px) {
  .format-choice {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 3.1rem;
  }
}
