:root {
  --paper: #f6f2e9;
  --ink: #221f1b;
  --ink-soft: #6f675c;
  --ink-faint: #a89f92;
  --line: #e6ddcd;
  --line-strong: #d6c9b3;
  --red: #bf4a37;
  --card: #fffdf8;
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --font-kai: "Kaiti SC", "STKaiti", "KaiTi", "楷体", "BiauKai", "Songti SC", "SimSun", serif;
  --font-serif: "Songti SC", "STSong", "Noto Serif SC", Georgia, serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(120% 90% at 50% -10%, #fdfaf3 0%, #f6f2e9 45%, #f1ebdf 100%);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; }

.bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 20px;
  background: rgba(247, 243, 234, .92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; }
.mark {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center;
  font-family: var(--font-kai); font-size: 22px; color: #fff;
  background: linear-gradient(160deg, #cd5f49, #a83c2b);
  box-shadow: 0 6px 14px rgba(168, 60, 43, .25);
}
.brand h1 { margin: 0; font-size: 15px; letter-spacing: .06em; font-weight: 600; }
.brand p { margin: 2px 0 0; font-size: 11px; color: var(--ink-faint); letter-spacing: .04em; }
.actions { display: flex; align-items: center; gap: 8px; }
.link { font-size: 12px; color: var(--ink-faint); text-decoration: none; margin-right: 4px; }
.link:hover { color: var(--red); }

.ghost {
  height: 36px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: #fffdf8;
  font-size: 12.5px; color: var(--ink-soft);
}
.ghost:hover { border-color: var(--line-strong); color: var(--ink); }
.primary {
  height: 36px; padding: 0 18px; border-radius: 999px; border: 0;
  background: linear-gradient(160deg, #c9573f, #a6392a);
  color: #fff8f0; font-size: 12.5px; letter-spacing: .04em;
  box-shadow: 0 8px 18px rgba(166, 57, 42, .24);
}
.primary:hover { filter: brightness(1.04); }

main {
  max-width: 1180px; margin: 0 auto;
  padding: 20px 20px 60px;
  display: grid; grid-template-columns: 340px 1fr; gap: 22px; align-items: start;
}

.panel {
  position: sticky; top: 84px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 6px 20px rgba(74, 58, 32, .06);
}
.field-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
label { font-size: 11px; letter-spacing: .14em; color: var(--ink-faint); }
.hint { font-size: 11px; color: var(--ink-faint); }

textarea {
  width: 100%; height: 110px; resize: vertical;
  border-radius: 12px; border: 1px solid var(--line);
  background: #fff; padding: 10px 12px;
  font-family: var(--font-kai); font-size: 17px; line-height: 1.7;
  color: var(--ink); outline: none;
}
textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(191, 74, 55, .1); }

.row { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 14px; }
.opt { display: flex; flex-direction: column; gap: 6px; }
.opt-label { font-size: 11px; color: var(--ink-faint); letter-spacing: .08em; }
.seg { display: flex; gap: 3px; padding: 3px; background: #f4eee2; border-radius: 10px; }
.seg button {
  border: 0; background: transparent; height: 28px; padding: 0 10px;
  border-radius: 8px; font-size: 12px; color: var(--ink-soft);
}
.seg button.on { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }

.status { margin-top: 14px; font-size: 12px; color: var(--ink-faint); }

.preview {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  background: #f3eee3; border-radius: 18px; padding: 16px;
  min-height: 420px;
}
#page {
  max-width: 100%; height: auto;
  background: #fff; border-radius: 2px;
  box-shadow: 0 12px 30px rgba(70, 55, 35, .16);
}
.pager { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--ink-soft); }
.pg {
  width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; font-size: 16px; color: var(--ink-soft);
}
.pg:disabled { opacity: .35; }

@media (max-width: 900px) {
  main { grid-template-columns: 1fr; }
  .panel { position: static; }
  .bar { flex-wrap: wrap; }
  .actions { width: 100%; justify-content: flex-end; }
}

input[type="text"] {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  font-family: var(--font-kai);
  font-size: 16px;
  color: var(--ink);
  outline: none;
}
input[type="text"]:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(191, 74, 55, .1); }

.preview.pulse { animation: previewPulse .5s ease; }
@keyframes previewPulse {
  0% { box-shadow: inset 0 0 0 0 rgba(191, 74, 55, 0); }
  35% { box-shadow: inset 0 0 0 3px rgba(191, 74, 55, .35); }
  100% { box-shadow: inset 0 0 0 0 rgba(191, 74, 55, 0); }
}

/* ---------------- 响应式：按钮不换行、头部可折行 ---------------- */
.bar { flex-wrap: wrap; row-gap: 10px; }
.actions { flex-wrap: wrap; row-gap: 8px; flex-shrink: 0; }
.brand { min-width: 0; }
.brand p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ghost, .primary, .link, .seg button, .pg { white-space: nowrap; flex-shrink: 0; }
.opt { min-width: 0; }
.seg { flex-wrap: wrap; }

@media (max-width: 900px) {
  .brand { width: 100%; }
  .actions { width: 100%; justify-content: flex-end; }
}

@media (max-width: 420px) {
  .bar { padding: 10px 14px; }
  .actions .link { width: 100%; margin: 0 0 2px; }
  .actions .ghost, .actions .primary { flex: 1 1 0; padding: 0 10px; }
}
