:root {
  color-scheme: light;
  --bg: #f4f7f9;
  --text: #182026;
  --muted: #66717c;
  --line: #d8e0e7;
  --panel: #ffffff;
  --accent: #176f62;
  --accent-strong: #0d5b50;
  --warn: #95631a;
  --danger: #a33a31;
  --code: #0f1720;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(23, 111, 98, 0.08), transparent 280px),
    var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
}

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

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

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(25, 42, 55, 0.08);
}

.form-panel {
  padding: 22px;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 24px;
}

.mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.2;
}

h2 {
  font-size: 18px;
  line-height: 1.3;
}

p,
.field span,
.status {
  color: var(--muted);
  font-size: 14px;
}

.field {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

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

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfdfe;
  color: var(--text);
  outline: none;
}

textarea {
  min-height: 132px;
  resize: vertical;
  padding: 12px;
  line-height: 1.5;
}

input,
select {
  height: 42px;
  padding: 0 10px;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 111, 98, 0.12);
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

button {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  padding: 0 14px;
}

button:hover:not(:disabled) {
  border-color: #9ab0bd;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

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

.status {
  min-height: 34px;
  margin-top: 16px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafb;
}

.status.ok {
  border-color: rgba(23, 111, 98, 0.35);
  color: var(--accent-strong);
}

.status.warn {
  border-color: rgba(149, 99, 26, 0.35);
  color: var(--warn);
}

.status.error {
  border-color: rgba(163, 58, 49, 0.35);
  color: var(--danger);
}

.result-panel {
  min-width: 0;
  overflow: hidden;
}

.result-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
}

#preview {
  min-height: 620px;
  max-height: calc(100vh - 160px);
  overflow: auto;
  margin: 0;
  padding: 18px;
  background: var(--code);
  color: #e8f0f2;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre;
}

@media (max-width: 860px) {
  .shell {
    width: min(100% - 20px, 720px);
    padding: 16px 0;
  }

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

  .result-head,
  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  #preview {
    min-height: 420px;
    max-height: 60vh;
  }
}
