:root {
  --paper: #f7f4ee;
  --ink: #191713;
  --muted: #6d675d;
  --line: #d9d0c2;
  --panel: #fffaf1;
  --accent: #d7412f;
  --accent-dark: #a92e21;
  --focus: #176f83;
  --shadow: 0 24px 70px rgba(60, 41, 24, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", Arial, sans-serif;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(25, 23, 19, 0.035) 1px, transparent 1px) 0 0 / 44px 44px,
    linear-gradient(180deg, #fff9ef 0%, var(--paper) 42%, #ede4d7 100%);
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 44px 0;
  display: grid;
  place-items: center;
}

.workspace {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.intro,
.generator,
.output-panel {
  border: 1px solid var(--line);
  background: rgba(255, 250, 241, 0.84);
  box-shadow: var(--shadow);
}

.intro {
  padding: 34px 32px;
  min-height: 320px;
  position: sticky;
  top: 28px;
  overflow: hidden;
}

.intro::after {
  content: "";
  position: absolute;
  right: 24px;
  bottom: 22px;
  width: 90px;
  height: 90px;
  border: 2px solid var(--accent);
  border-left-color: transparent;
  transform: rotate(18deg);
  opacity: 0.34;
}

.eyebrow,
.section-label,
.hint,
.status {
  margin: 0;
  color: var(--muted);
}

.eyebrow,
.section-label {
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

h1,
h2 {
  margin: 0;
  line-height: 1.1;
}

h1 {
  margin-top: 18px;
  font-size: clamp(34px, 6vw, 62px);
  font-weight: 800;
}

h2 {
  margin-top: 7px;
  font-size: 22px;
}

.lede {
  margin: 22px 0 0;
  color: #3e3931;
  font-size: 17px;
  line-height: 1.8;
}

.generator,
.output-panel {
  grid-column: 2;
}

.generator {
  padding: 24px;
}

.generator label {
  display: block;
  margin-bottom: 10px;
  font-weight: 800;
}

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

input {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 16px;
  color: var(--ink);
  background: #fffefd;
  outline: none;
}

input:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(23, 111, 131, 0.16);
}

.primary-button,
.ghost-button {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.primary-button {
  min-width: 138px;
  padding: 0 20px;
  color: #fff;
  background: var(--accent);
}

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

.primary-button:active,
.ghost-button:active {
  transform: translateY(1px);
}

.primary-button:disabled,
.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.hint,
.status {
  min-height: 22px;
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.7;
}

.status[data-tone="error"] {
  color: var(--accent-dark);
  font-weight: 700;
}

.status[data-tone="ok"] {
  color: var(--focus);
  font-weight: 700;
}

.output-panel {
  margin-top: 20px;
  overflow: hidden;
}

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

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

.ghost-button {
  padding: 0 15px;
  color: var(--ink);
  background: #fffefd;
  border: 1px solid var(--line);
}

.ghost-button:hover:not(:disabled) {
  border-color: var(--focus);
}

.result {
  min-height: 520px;
  max-height: 62vh;
  margin: 0;
  padding: 26px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: #26221c;
  background:
    repeating-linear-gradient(180deg, rgba(215, 65, 47, 0.055) 0 1px, transparent 1px 34px),
    #fffefd;
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", Arial, sans-serif;
  font-size: 16px;
  line-height: 2.1;
}

.result:focus {
  outline: 3px solid rgba(23, 111, 131, 0.18);
  outline-offset: -3px;
}

@media (max-width: 840px) {
  .app-shell {
    width: min(100% - 22px, 680px);
    padding: 18px 0;
    place-items: start;
  }

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

  .intro,
  .generator,
  .output-panel {
    grid-column: 1;
  }

  .intro {
    position: relative;
    top: auto;
    min-height: 0;
    padding: 26px 22px;
  }

  .lede {
    font-size: 15px;
  }

  .generator {
    padding: 18px;
  }

  .input-row {
    grid-template-columns: 1fr;
  }

  .primary-button {
    width: 100%;
  }

  .output-head {
    padding: 18px;
    align-items: flex-start;
    flex-direction: column;
  }

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

  .ghost-button {
    flex: 1 1 120px;
  }

  .result {
    min-height: 430px;
    max-height: none;
    padding: 20px 18px;
    font-size: 15px;
    line-height: 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
