:root {
  --bg: #f7f2ea;
  --ink: #1b2830;
  --muted: #65717a;
  --line: #ddd3c4;
  --panel: #fffdf9;
  --accent: #0f776d;
  --accent-dark: #08564e;
  --rose: #a74f62;
  --shadow: 0 22px 58px rgba(31, 38, 45, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background:
    linear-gradient(125deg, rgba(15, 119, 109, 0.13), transparent 42%),
    linear-gradient(245deg, rgba(189, 134, 43, 0.14), transparent 44%),
    var(--bg);
}

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

button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  min-height: 44px;
  padding: 0 16px;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

button:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

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

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  color: #fff;
  background: var(--accent);
  font-weight: 900;
  font-size: 22px;
  flex: 0 0 auto;
}

h1,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.18;
}

.hero p,
.hint {
  color: var(--muted);
  line-height: 1.6;
}

.hero p {
  margin-top: 7px;
}

.tool-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.panel {
  background: rgba(255, 253, 249, 0.94);
  border: 1px solid rgba(221, 211, 196, 0.95);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.settings {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 20px;
}

.field {
  display: grid;
  gap: 8px;
}

label {
  font-size: 14px;
  font-weight: 800;
}

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

textarea {
  resize: vertical;
  line-height: 1.65;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 119, 109, 0.14);
}

.primary {
  margin-top: 4px;
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 900;
}

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

.output {
  display: flex;
  flex-direction: column;
  min-height: 590px;
  padding: 20px;
}

.output-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.tag {
  max-width: 70%;
  color: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 900;
  background: var(--rose);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result {
  flex: 1;
  min-height: 430px;
  border-color: rgba(221, 211, 196, 0.85);
  font-size: 17px;
  line-height: 1.85;
}

.hint {
  margin-top: 12px;
  font-size: 13px;
}

.copy-helper {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.copy-sheet[hidden] {
  display: none;
}

.copy-sheet {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(27, 40, 48, 0.42);
}

.sheet-card {
  width: min(560px, 100%);
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 18px;
}

.sheet-card h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.sheet-card p {
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 12px;
}

#manualCopy {
  min-height: 220px;
  font-size: 16px;
  line-height: 1.75;
}

.sheet-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 24px, 1060px);
    padding: 16px 0;
  }

  .tool-layout {
    grid-template-columns: 1fr;
  }

  .settings {
    gap: 12px;
  }

  .output {
    min-height: 430px;
  }

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

@media (max-width: 520px) {
  .app-shell {
    width: 100%;
    padding: 0;
  }

  .hero {
    align-items: flex-start;
    padding: 14px 14px 10px;
    margin-bottom: 0;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }

  h1 {
    font-size: 21px;
  }

  .hero p {
    font-size: 14px;
  }

  .tool-layout {
    gap: 10px;
  }

  .panel {
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .settings,
  .output {
    padding: 14px;
  }

  input,
  select,
  textarea,
  button {
    min-height: 46px;
    font-size: 16px;
  }

  .output-head {
    position: sticky;
    top: 0;
    z-index: 1;
    background: rgba(255, 253, 249, 0.96);
    padding-bottom: 10px;
  }

  .result {
    min-height: 320px;
    font-size: 16px;
    line-height: 1.78;
  }

  .copy-sheet {
    align-items: end;
    padding: 0;
  }

  .sheet-card {
    border-radius: 8px 8px 0 0;
    border-left: 0;
    border-right: 0;
  }

  .sheet-actions {
    grid-template-columns: 1fr;
  }
}
