:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #1f2933;
  --muted: #697386;
  --border: #d8dee6;
  --primary: #126f5c;
  --primary-strong: #0d5a4a;
  --soft: #edf6f3;
  --danger: #a33b2f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
textarea,
pre {
  font: inherit;
}

.app {
  min-height: 100vh;
  padding: 24px;
  max-width: 1180px;
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 16px;
  padding-bottom: 16px;
}

h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: 0;
}

.status {
  min-height: 22px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.cell {
  display: grid;
  grid-template-rows: auto minmax(220px, 1fr);
  gap: 8px;
  min-height: 282px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.cell-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 34px;
}

.cell-header label,
.cell-header h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.cell-header span {
  color: var(--muted);
  font-size: 13px;
}

textarea {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  background: #fff;
  line-height: 1.6;
}

textarea:focus {
  outline: 3px solid rgba(22, 122, 91, 0.18);
  border-color: var(--primary);
}

button {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--primary);
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}

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

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

.copy-button,
.inline-action {
  background: #fff;
  color: var(--primary);
}

.copy-button:hover,
.inline-action:hover {
  background: var(--soft);
}

.copy-button,
.inline-action {
  min-height: 32px;
  padding: 0 10px;
  font-size: 13px;
}

.result-text {
  min-height: 220px;
  margin: 0;
  padding: 12px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #f9fafb;
  line-height: 1.6;
}

.status.error {
  color: var(--danger);
}

@media (max-width: 820px) {
  .app {
    padding: 14px;
  }

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

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

  .cell {
    min-height: 232px;
  }

  textarea,
  .result-text {
    min-height: 180px;
  }
}
