:root {
  color-scheme: light;
  --ink: #202124;
  --muted: #667085;
  --line: #d9dee8;
  --paper: #fbfaf7;
  --panel: #ffffff;
  --green: #1f7a5a;
  --green-dark: #145c43;
  --blue: #315f9f;
  --amber: #c98522;
  --shadow: 0 18px 50px rgba(42, 52, 69, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
  background:
    linear-gradient(135deg, rgba(31, 122, 90, 0.09), transparent 34%),
    linear-gradient(315deg, rgba(49, 95, 159, 0.1), transparent 36%),
    var(--paper);
}

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

button {
  cursor: pointer;
}

.app-shell {
  width: min(1540px, 100%);
  margin: 0 auto;
  padding: 28px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(460px, 680px) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
  min-height: calc(100vh - 56px);
}

.panel {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(217, 222, 232, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.input-panel {
  padding: 24px;
  overflow: auto;
}

.brand {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
}

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

h1 {
  font-size: 30px;
}

h2 {
  font-size: 22px;
}

.brand p:last-child {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.form {
  display: grid;
  gap: 16px;
  padding-top: 18px;
}

.type-switcher {
  display: grid;
  gap: 8px;
}

.type-switcher > span {
  color: #394150;
  font-size: 14px;
  font-weight: 700;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9fb;
}

.segmented button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  padding: 0 10px;
  color: #475467;
  background: transparent;
  font-size: 14px;
  font-weight: 700;
}

.segmented button.is-active {
  color: #fff;
  background: var(--green);
}

.dynamic-fields {
  display: grid;
  gap: 16px;
}

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

label {
  display: grid;
  gap: 7px;
}

label span {
  color: #394150;
  font-size: 14px;
  font-weight: 700;
}

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

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

textarea {
  min-height: 92px;
  resize: vertical;
  padding: 11px 12px;
  line-height: 1.65;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 122, 90, 0.12);
}

.smart-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 184px;
  gap: 12px;
  align-items: start;
}

.quick-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 25px;
}

.quick-picks p {
  width: 100%;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.quick-picks button,
.tone,
.secondary,
.ghost,
.output-actions button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  color: #394150;
  background: #fff;
}

.quick-picks button {
  min-height: 32px;
  color: var(--green-dark);
  background: rgba(31, 122, 90, 0.07);
  border-color: rgba(31, 122, 90, 0.2);
  font-size: 13px;
}

.quick-picks button.is-picked {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}

.tone-row,
.actions,
.output-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.tone {
  min-height: 38px;
}

.tone.is-active {
  border-color: var(--green);
  color: var(--green-dark);
  background: rgba(31, 122, 90, 0.1);
  font-weight: 700;
}

.primary {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 0 18px;
  color: #fff;
  background: var(--green);
  font-weight: 700;
}

.primary:hover {
  background: var(--green-dark);
}

.ghost:hover,
.secondary:hover,
.tone:hover,
.output-actions button:hover,
.quick-picks button:hover,
.segmented button:hover {
  border-color: #b6bfcd;
  background: #f7f9fb;
}

.segmented button.is-active:hover {
  background: var(--green-dark);
}

.quick-picks button.is-picked:hover {
  background: var(--green-dark);
}

.output-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.output-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 24px 26px;
  border-bottom: 1px solid var(--line);
}

.result {
  flex: 1;
  margin: 0;
  padding: 30px 42px;
  overflow: auto;
  background:
    linear-gradient(#fff, #fff) padding-box,
    repeating-linear-gradient(0deg, transparent, transparent 31px, rgba(49, 95, 159, 0.08) 32px);
  line-height: 2;
  font-size: 17px;
}

.result:focus {
  outline: 3px solid rgba(31, 122, 90, 0.2);
  outline-offset: -3px;
}

.result.empty {
  color: var(--muted);
}

.result h3 {
  margin: 0 0 18px;
  text-align: center;
  font-size: 24px;
  line-height: 1.4;
}

.result p {
  margin: 0 0 16px;
  text-indent: 2em;
}

.result .signature {
  margin-top: 28px;
  text-align: right;
  text-indent: 0;
}

.helper-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
  background: #f7f8f5;
}

.helper-strip div {
  display: grid;
  gap: 4px;
  padding: 16px 18px;
  border-right: 1px solid var(--line);
}

.helper-strip div:last-child {
  border-right: 0;
}

.helper-strip strong {
  color: var(--green-dark);
}

.helper-strip span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

@media (max-width: 1180px) {
  .smart-field {
    grid-template-columns: 1fr;
  }

  .quick-picks {
    padding-top: 0;
  }
}

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

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

  .field-grid,
  .helper-strip,
  .segmented {
    grid-template-columns: 1fr;
  }

  .helper-strip div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .helper-strip div:last-child {
    border-bottom: 0;
  }
}

@media (max-width: 620px) {
  h1 {
    font-size: 24px;
  }

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

  .output-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .result {
    padding: 22px 18px;
    font-size: 16px;
  }
}

@media print {
  body {
    background: #fff;
  }

  .input-panel,
  .helper-strip,
  .output-header {
    display: none;
  }

  .app-shell,
  .workspace,
  .output-panel,
  .result {
    display: block;
    width: 100%;
    min-height: 0;
    padding: 0;
    margin: 0;
    box-shadow: none;
    border: 0;
  }
}
