:root {
  color-scheme: light;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --bg: #fff4e7;
  --panel: #fffaf4;
  --ink: #2c2118;
  --muted: #7d6958;
  --orange: #f47c25;
  --orange-dark: #c65212;
  --orange-soft: #ffe0bf;
  --line: #f0caa3;
  --green: #18b565;
  --green-soft: #dcf8c6;
  --red: #df3b30;
  --yellow: #d99012;
  --shadow: 0 18px 45px rgba(122, 70, 21, 0.14);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background:
    radial-gradient(circle at 18% 4%, rgba(255, 189, 104, 0.42), transparent 30%),
    linear-gradient(180deg, #fff0dd 0%, #fff8ee 62%, #fff4e7 100%);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
}

button,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  cursor: not-allowed;
}

.app-shell {
  width: min(100%, 480px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px 16px 28px;
}

.hero {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 6px 2px 20px;
}

.logo {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 2px solid rgba(244, 124, 37, 0.28);
  border-radius: 8px;
  background: #fffaf5;
  box-shadow: 0 10px 24px rgba(244, 124, 37, 0.14);
  font-size: 31px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.05;
  letter-spacing: 0;
}

.hero p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 15px;
}

.composer,
.result {
  border: 1px solid rgba(240, 202, 163, 0.86);
  border-radius: 8px;
  background: rgba(255, 250, 244, 0.92);
  box-shadow: var(--shadow);
}

.composer {
  padding: 16px;
}

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

h2,
legend {
  color: #4b2d19;
  font-size: 16px;
  font-weight: 800;
}

.ghost-button {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid rgba(244, 124, 37, 0.34);
  border-radius: 8px;
  background: #fff7ee;
  color: var(--orange-dark);
  font-size: 14px;
  font-weight: 700;
}

.examples {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.examples button {
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid rgba(244, 124, 37, 0.22);
  border-radius: 8px;
  background: #fffdf9;
  color: #4d3727;
  text-align: left;
  line-height: 1.35;
}

textarea {
  display: block;
  width: 100%;
  min-height: 134px;
  resize: vertical;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: #fffdf9;
  color: var(--ink);
  padding: 14px;
  line-height: 1.55;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

textarea:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 4px rgba(244, 124, 37, 0.13);
}

textarea::placeholder {
  color: #a9927e;
}

.tone-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 16px 0;
  padding: 0;
  border: 0;
}

.tone-picker legend {
  grid-column: 1 / -1;
  margin-bottom: 2px;
}

.tone-picker label {
  position: relative;
  min-width: 0;
}

.tone-picker input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.tone-picker span {
  display: grid;
  align-content: start;
  min-height: 92px;
  padding: 11px 8px;
  border: 1.5px solid rgba(240, 202, 163, 0.95);
  border-radius: 8px;
  background: #fffdf9;
  color: var(--muted);
  text-align: center;
  transition:
    border-color 0.16s ease,
    background 0.16s ease,
    transform 0.16s ease;
}

.tone-picker strong {
  color: #3f2819;
  font-size: 14px;
  line-height: 1.28;
}

.tone-picker small {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.3;
}

.tone-picker input:checked + span {
  border-color: var(--orange);
  background: var(--orange-soft);
  color: #6d3b13;
  transform: translateY(-1px);
}

.primary-button,
.secondary-button,
.copy-button {
  width: 100%;
  min-height: 48px;
  border-radius: 8px;
  font-weight: 850;
}

.primary-button {
  background: linear-gradient(180deg, #ff9542 0%, var(--orange) 100%);
  color: #fff;
  box-shadow: 0 10px 22px rgba(244, 124, 37, 0.3);
}

.primary-button:disabled {
  background: #e7d5c2;
  color: #9e8066;
  box-shadow: none;
}

.error {
  margin-top: 12px;
  color: #b1271d;
  font-size: 14px;
  line-height: 1.45;
}

.result {
  margin-top: 16px;
  padding: 16px;
}

.verdict-row {
  display: flex;
  margin-bottom: 14px;
}

.verdict-label {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 14px;
  font-weight: 850;
}

.verdict-label.is-half {
  background: var(--yellow);
}

.verdict-label.is-ok {
  background: var(--green);
}

.result-block + .result-block {
  margin-top: 16px;
}

.result-block p {
  margin-top: 8px;
  color: #5e4938;
  font-size: 15px;
  line-height: 1.65;
}

.wechat-bubble {
  position: relative;
  margin: 10px 0 12px;
  padding: 13px 14px;
  border-radius: 8px;
  background: var(--green-soft);
  color: #1e271d;
  font-size: 16px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.wechat-bubble::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 18px;
  border-top: 7px solid transparent;
  border-right: 8px solid var(--green-soft);
  border-bottom: 7px solid transparent;
}

.copy-button {
  border: 1px solid rgba(24, 181, 101, 0.28);
  background: #ecfff4;
  color: #08723b;
}

.secondary-button {
  border: 1px solid rgba(244, 124, 37, 0.36);
  background: #fff3e5;
  color: var(--orange-dark);
}

.secondary-button:disabled {
  background: #efe0d1;
  color: #9e8066;
}

.quiet-button {
  background: #fffaf4;
}

/* ── 图片生成区 ── */
.image-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.image-style-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 10px 0 12px;
}

.style-btn {
  min-height: 48px;
  padding: 0 10px;
  border: 1.5px solid rgba(240, 202, 163, 0.95);
  border-radius: 8px;
  background: #fffdf9;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  transition:
    border-color 0.15s,
    background 0.15s,
    color 0.15s,
    transform 0.15s;
}

.style-btn.is-active {
  border-color: var(--orange);
  background: var(--orange-soft);
  color: var(--orange-dark);
  transform: translateY(-1px);
}

.generate-image-btn {
  width: 100%;
  min-height: 48px;
  border-radius: 8px;
  border: 1.5px solid rgba(244, 124, 37, 0.5);
  background: #fff3e5;
  color: var(--orange-dark);
  font-size: 15px;
  font-weight: 850;
}

.generate-image-btn:disabled {
  background: #efe0d1;
  color: #9e8066;
  border-color: transparent;
  cursor: not-allowed;
}

.image-error {
  margin-top: 10px;
  color: #b1271d;
  font-size: 14px;
  line-height: 1.45;
}

.image-result {
  margin-top: 14px;
}

.image-result img {
  display: block;
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: 0 6px 18px rgba(122, 70, 21, 0.12);
}

.save-btn {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-top: 10px;
  border-radius: 8px;
  border: 1px solid rgba(24, 181, 101, 0.28);
  background: #ecfff4;
  color: #08723b;
  font-size: 15px;
  font-weight: 850;
  text-align: center;
  line-height: 48px;
  text-decoration: none;
}

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

footer {
  padding: 22px 6px 0;
  color: #927a66;
  text-align: center;
  font-size: 12px;
  line-height: 1.5;
}

@media (max-width: 360px) {
  .app-shell {
    padding-inline: 12px;
  }

  .tone-picker {
    gap: 6px;
  }

  .tone-picker span {
    min-height: 102px;
    padding-inline: 6px;
  }

  .tone-picker strong {
    font-size: 13px;
  }
}
