:root {
  --bg: #f6f1e8;
  --paper: rgba(255, 251, 244, 0.86);
  --paper-strong: #fffdf8;
  --line: rgba(126, 96, 54, 0.18);
  --line-strong: rgba(111, 79, 35, 0.28);
  --ink: #2f2418;
  --ink-soft: #75614a;
  --brand: #9f5a2f;
  --brand-deep: #7a3f1d;
  --brand-soft: #efe0cf;
  --choice-active: #d8b186;
  --choice-active-deep: #c89a67;
  --green: #6f8a5c;
  --shadow: 0 18px 46px rgba(74, 51, 24, 0.10);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "KaiTi", "STKaiti", "Kaiti SC", serif;
  background:
    radial-gradient(circle at top left, rgba(255,255,255,0.55), transparent 32%),
    linear-gradient(180deg, rgba(248,243,235,0.96), rgba(241,232,217,0.92));
}
button, input, select, textarea, a { font: inherit; }
button { cursor: pointer; }

.page-shell {
  width: min(1280px, calc(100vw - 32px));
  margin: 18px auto 28px;
  display: grid;
  gap: 18px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  padding: 20px 2px 18px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 14px;
  letter-spacing: 1px;
}
.hero h1 {
  margin: 0;
  font-size: 40px;
  line-height: 1.1;
}
.hero-copy {
  max-width: 760px;
  margin: 14px 0 0;
  color: var(--ink-soft);
  font-size: 18px;
  line-height: 1.7;
}
.hero-status {
  min-width: 180px;
  display: grid;
  gap: 8px;
  justify-items: end;
}
.status-label {
  color: var(--ink-soft);
  font-size: 14px;
}
.status-pill {
  padding: 10px 18px;
  border-radius: 999px;
  color: #fffaf2;
  background: linear-gradient(180deg, var(--brand), var(--brand-deep));
  box-shadow: 0 10px 24px rgba(125, 75, 27, 0.22);
}

.workspace {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 18px;
}
.panel {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}
.form-panel, .side-panel, .result-panel {
  padding: 24px;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
}
.panel-head h2 {
  margin: 0;
  font-size: 28px;
}
.panel-head p {
  margin: 6px 0 0;
  color: var(--ink-soft);
  line-height: 1.6;
}
.task-form {
  display: grid;
  gap: 16px;
}
.form-stage {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid rgba(126, 96, 54, 0.15);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255,253,248,0.78), rgba(248,239,227,0.46));
}
.soft-stage {
  background: rgba(255,255,255,0.38);
}
.stage-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.stage-head.compact {
  margin-bottom: -4px;
}
.stage-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 999px;
  color: #fffaf3;
  background: linear-gradient(180deg, var(--brand), var(--brand-deep));
  box-shadow: 0 8px 18px rgba(125, 75, 27, 0.16);
}
.stage-head h3 {
  margin: 0;
  font-size: 21px;
}
.stage-head p {
  margin: 5px 0 0;
  color: var(--ink-soft);
  line-height: 1.55;
}
.grid.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.choice-field {
  display: grid;
  gap: 10px;
}
.field-title {
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  font-size: 16px;
  font-weight: 600;
}
.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px;
  border: 1px solid rgba(126, 96, 54, 0.16);
  border-radius: 18px;
  background: rgba(255,255,255,0.55);
}
.choice-btn,
.ratio-card,
.count-card {
  border: 1px solid transparent;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  color: var(--ink);
  background: rgba(255,255,255,0.62);
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}
.choice-btn:hover,
.ratio-card:hover,
.count-card:hover {
  border-color: rgba(159, 90, 47, 0.32);
  transform: translateY(-1px);
}
.choice-btn.is-active,
.ratio-card.is-active,
.count-card.is-active {
  color: #4b2f1d;
  border-color: rgba(159, 90, 47, 0.32);
  background: linear-gradient(180deg, var(--choice-active), var(--choice-active-deep));
  box-shadow: 0 10px 22px rgba(125, 75, 27, 0.12);
}
.choice-btn {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 13px;
}
.segmented .choice-btn {
  flex: 1 1 92px;
}
.ratio-grid,
.count-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}
.ratio-card {
  min-height: 68px;
  display: grid;
  place-items: center;
  gap: 3px;
  padding: 10px 8px;
  border-radius: 16px;
}
.ratio-card span {
  font-size: 18px;
  line-height: 1;
}
.ratio-card small {
  color: inherit;
  opacity: 0.72;
}
.count-card {
  min-height: 52px;
  border-radius: 15px;
  font-size: 20px;
}
textarea {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  border: 1px solid rgba(111, 79, 35, 0.22);
  border-radius: 16px;
  background: rgba(255,255,255,0.58);
  color: var(--ink);
  padding: 13px 15px;
  line-height: 1.65;
  outline: none;
}
textarea::placeholder {
  color: rgba(117, 97, 74, 0.78);
}
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(159, 90, 47, 0.10);
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 2px;
}
.primary-btn, .secondary-btn, .ghost-btn, .download-all, .save-all, .small-btn, .link-btn {
  min-height: 48px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid transparent;
  text-decoration: none;
}
.primary-btn {
  color: #fffaf3;
  background: linear-gradient(180deg, var(--brand), var(--brand-deep));
}
.secondary-btn {
  color: var(--brand-deep);
  background: var(--brand-soft);
  border-color: rgba(159, 90, 47, 0.22);
}
.ghost-btn {
  color: var(--ink);
  background: rgba(255,255,255,0.56);
  border-color: var(--line);
}
.primary-btn:disabled,
.secondary-btn:disabled,
.ghost-btn:disabled,
.download-all:disabled,
.save-all:disabled,
.choice-btn:disabled,
.ratio-card:disabled,
.count-card:disabled,
textarea:disabled {
  opacity: 0.56;
  cursor: not-allowed;
  transform: none;
}
.status-summary {
  padding: 16px 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(250,242,232,0.95), rgba(255,252,247,0.82));
  border: 1px solid rgba(159, 90, 47, 0.16);
}
.status-summary strong {
  display: block;
  margin-bottom: 6px;
  font-size: 19px;
}
.status-summary span {
  color: var(--ink-soft);
  line-height: 1.7;
}
.progress-list {
  margin-top: 16px;
  display: grid;
  gap: 10px;
  max-height: 560px;
  overflow: auto;
  padding-right: 4px;
}
.progress-item {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255,255,255,0.62);
  border: 1px solid var(--line);
}
.progress-item .dot {
  width: 10px;
  height: 10px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--brand);
}
.progress-item.image .dot,
.progress-item.done .dot { background: var(--green); }
.progress-item.error .dot { background: #b24636; }
.progress-item.warn .dot { background: #ad7a22; }
.result-head {
  align-items: center;
}
.download-all {
  color: #fffaf3;
  background: linear-gradient(180deg, #8d6a32, #6d5125);
}
.save-all {
  color: var(--brand-deep);
  background: rgba(255,255,255,0.68);
  border-color: rgba(159, 90, 47, 0.22);
}
.result-empty {
  padding: 26px 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
  color: var(--ink-soft);
  background: rgba(255,255,255,0.42);
}
.result-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.result-card {
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--paper-strong);
  box-shadow: 0 12px 28px rgba(73, 49, 24, 0.09);
}
.result-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}
.result-body {
  padding: 14px;
}
.result-body strong {
  display: block;
  font-size: 17px;
}
.result-body p {
  margin: 8px 0 0;
  color: var(--ink-soft);
  line-height: 1.6;
}
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.small-btn, .link-btn {
  min-height: 38px;
  padding: 0 12px;
  color: var(--ink);
  background: #f5ede2;
  border-color: rgba(115, 84, 45, 0.12);
}
.link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
  }
  .hero {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  padding: 20px 2px 18px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
  .hero-status {
    justify-items: start;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100vw - 18px, 100%);
    margin: 10px auto 18px;
  }
  .hero, .form-panel, .side-panel, .result-panel {
    padding: 18px;
  }
  .hero h1 {
    font-size: 30px;
  }
  .form-stage {
    padding: 15px;
  }
  .grid.two-col {
    grid-template-columns: 1fr;
  }
  .ratio-grid,
  .count-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .actions {
    flex-direction: column;
  }
  .primary-btn, .secondary-btn, .ghost-btn, .download-all {
    width: 100%;
  }
}
/* clean-layout-20260904 start */
.form-panel {
  padding: 26px 28px 28px;
}

.panel-head {
  margin-bottom: 16px;
}

.panel-head h2 {
  font-size: 30px;
  letter-spacing: 0.02em;
}

.task-form {
  gap: 8px;
}

.form-stage {
  padding: 18px 0 20px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  border-bottom: 1px solid rgba(126, 96, 54, 0.14);
}

.form-stage:last-of-type {
  border-bottom: 0;
  padding-bottom: 12px;
}

.stage-head {
  align-items: center;
  margin-bottom: 8px;
}

.stage-index {
  display: none;
}

.stage-head h3 {
  font-size: 20px;
  letter-spacing: 0.02em;
}

.stage-head p {
  display: none;
}

.choice-field {
  grid-template-columns: 108px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  min-height: 48px;
}

.grid.two-col {
  gap: 14px 22px;
}

.grid.two-col .choice-field {
  grid-template-columns: 108px minmax(0, 1fr);
}

.field-title {
  font-size: 15px;
  color: #5f4a38;
  letter-spacing: 0.02em;
}

.segmented {
  gap: 6px;
  padding: 4px;
  border: 1px solid rgba(126, 96, 54, 0.12);
  border-radius: 14px;
  background: rgba(255,255,255,0.42);
}

.choice-btn {
  min-height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 15px;
}

.ratio-grid,
.count-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.ratio-card,
.count-card {
  min-height: 46px;
  border-radius: 13px;
  padding: 7px 8px;
  background: rgba(255,255,255,0.52);
}

.ratio-card span,
.count-card {
  font-size: 17px;
}

.ratio-card small {
  font-size: 12px;
  opacity: 0.68;
}

.choice-btn.is-active,
.ratio-card.is-active,
.count-card.is-active {
  color: #3c291b;
  border-color: rgba(159, 90, 47, 0.34);
  background: linear-gradient(180deg, #e6c39b, #d5a66f);
  box-shadow: 0 6px 14px rgba(125, 75, 27, 0.10);
}

.soft-stage {
  padding-top: 16px;
}

textarea {
  min-height: 86px;
  background: rgba(255,255,255,0.48);
}

.actions {
  padding-top: 10px;
}

@media (max-width: 1120px) {
  .choice-field,
  .grid.two-col .choice-field {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 8px;
  }
}

@media (max-width: 720px) {
  .ratio-grid,
  .count-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
/* clean-layout-20260904 end */
/* fine-tune-20260904 start */
.form-stage {
  padding-top: 10px;
}

.field-title {
  font-size: 18px;
  font-weight: 700;
}

.ratio-card {
  min-height: 42px;
  align-content: center;
}

.ratio-card span {
  font-size: 18px;
}

.ratio-card small {
  display: none;
}
/* fine-tune-20260904 end */
/* tune-readability-20260904 start */
.stage-head.compact h3 {
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #5f4a38;
  letter-spacing: 0.02em;
}

.ratio-grid {
  grid-template-columns: repeat(5, minmax(72px, 1fr));
}

.ratio-card {
  min-width: 72px;
  padding-left: 10px;
  padding-right: 10px;
}

.ratio-card span {
  font-size: 18px;
  white-space: nowrap;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.download-all,
.small-btn,
.link-btn {
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.download-all {
  min-width: 128px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
/* tune-readability-20260904 end */
/* layout-stack-20260904 start */
.form-stage {
  border-bottom: 0;
}

.param-stack {
  display: grid;
  gap: 14px;
}

.param-stack .choice-field {
  grid-template-columns: 108px minmax(0, 1fr);
}
/* layout-stack-20260904 end */
/* action-buttons-neutral-20260904 start */
.primary-btn,
.secondary-btn,
.ghost-btn {
  color: var(--ink);
  background: rgba(255,255,255,0.58);
  border-color: rgba(126, 96, 54, 0.18);
  box-shadow: none;
}

.primary-btn:hover:not(:disabled),
.secondary-btn:hover:not(:disabled),
.ghost-btn:hover:not(:disabled) {
  color: #4b2f1d;
  background: #ead0af;
  border-color: rgba(159, 90, 47, 0.30);
}

.primary-btn:active:not(:disabled),
.secondary-btn:active:not(:disabled),
.ghost-btn:active:not(:disabled) {
  background: linear-gradient(180deg, #e2bd91, #d2a06a);
  border-color: rgba(122, 63, 29, 0.34);
  transform: translateY(1px);
}

.ghost-btn:disabled {
  color: rgba(47, 36, 24, 0.40);
  background: rgba(255,255,255,0.36);
  border-color: rgba(126, 96, 54, 0.10);
}
/* action-buttons-neutral-20260904 end */
/* poem-picker-20260905 start */
.poem-picker {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 10px 14px;
  align-items: start;
  padding: 4px 0 2px;
}

.poem-picker-head {
  display: contents;
}

.selected-count {
  justify-self: start;
  align-self: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  color: #6a513d;
  background: rgba(234, 208, 175, 0.45);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  font-size: 13px;
}

.poem-tools,
.poem-list,
.selected-poems {
  grid-column: 2;
}

.poem-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.poem-search {
  width: 100%;
  min-height: 40px;
  border: 1px solid rgba(126, 96, 54, 0.16);
  border-radius: 12px;
  color: var(--ink);
  background: rgba(255,255,255,0.54);
  padding: 0 13px;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  outline: none;
}

.poem-search:focus {
  border-color: rgba(159, 90, 47, 0.42);
  box-shadow: 0 0 0 4px rgba(159, 90, 47, 0.08);
}

.tool-btn {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(126, 96, 54, 0.16);
  border-radius: 12px;
  color: var(--ink);
  background: rgba(255,255,255,0.50);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
}

.tool-btn:hover {
  background: #ead0af;
  border-color: rgba(159, 90, 47, 0.30);
}

.poem-list {
  display: grid;
  gap: 8px;
  max-height: 238px;
  overflow: auto;
  padding-right: 4px;
}

.poem-item {
  border: 1px solid rgba(126, 96, 54, 0.13);
  border-radius: 14px;
  background: rgba(255,255,255,0.42);
}

.poem-item[open] {
  background: rgba(255,255,255,0.58);
}

.poem-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 0 12px;
  list-style: none;
  cursor: pointer;
}

.poem-item summary::-webkit-details-marker {
  display: none;
}

.poem-check {
  display: grid;
  grid-template-columns: 18px minmax(72px, auto) auto;
  align-items: center;
  gap: 8px;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
}

.poem-check input {
  width: 16px;
  height: 16px;
  accent-color: #c89a67;
}

.poem-title {
  font-size: 15px;
  font-weight: 700;
}

.poem-author,
.poem-open {
  color: #75614a;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  font-size: 13px;
}

.poem-item p {
  margin: 0;
  padding: 0 14px 12px 38px;
  color: #5f4a38;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  font-size: 14px;
  line-height: 1.7;
}

.poem-empty {
  padding: 12px 14px;
  border-radius: 12px;
  color: #75614a;
  background: rgba(255,255,255,0.42);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
}

.selected-poems {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.selected-poems span {
  padding: 5px 10px;
  border-radius: 999px;
  color: #4b2f1d;
  background: rgba(230, 195, 155, 0.58);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  font-size: 13px;
}

@media (max-width: 1120px) {
  .poem-picker {
    grid-template-columns: 1fr;
  }

  .poem-tools,
  .poem-list,
  .selected-poems {
    grid-column: 1;
  }
}
/* poem-picker-20260905 end */

/* poem-filter-20260905 start */
.poem-tools {
  grid-template-columns: minmax(220px, 1fr) auto auto;
}

.author-filters {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  max-height: 86px;
  overflow: auto;
  padding: 2px 2px 4px 0;
}

.author-chip {
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid rgba(126, 96, 54, 0.14);
  border-radius: 999px;
  color: #5f4a38;
  background: rgba(255,255,255,0.46);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  font-size: 13px;
}

.author-chip:hover {
  background: #ead0af;
  border-color: rgba(159, 90, 47, 0.30);
}

.author-chip.is-active {
  color: #3c291b;
  background: linear-gradient(180deg, #e6c39b, #d5a66f);
  border-color: rgba(159, 90, 47, 0.34);
}

.selected-count {
  line-height: 1.45;
}

@media (max-width: 1120px) {
  .author-filters {
    grid-column: 1;
  }
}

@media (max-width: 720px) {
  .poem-tools {
    grid-template-columns: 1fr;
  }
}
/* poem-filter-20260905 end */

/* field-separators-20260905 start */
.choice-field,
.poem-picker {
  position: relative;
  padding-bottom: 14px;
  margin-bottom: 2px;
}

.choice-field::after,
.poem-picker::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: rgba(126, 96, 54, 0.24);
}

.form-stage > .choice-field:last-child::after,
.param-stack > .choice-field:last-child::after,
.soft-stage .choice-field::after {
  display: none;
}
/* field-separators-20260905 end */

.result-preview-btn {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}
.result-preview-btn img {
  display: block;
}
.image-preview-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(38, 28, 18, 0.62);
  backdrop-filter: blur(8px);
}
.image-preview-dialog {
  position: relative;
  width: min(1180px, 94vw);
  max-height: 92vh;
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 24px;
  background: var(--paper-strong);
  box-shadow: 0 28px 80px rgba(28, 18, 8, 0.28);
}
.image-preview-dialog img {
  width: 100%;
  max-height: 76vh;
  object-fit: contain;
  border-radius: 18px;
  background: #120d08;
}
.image-preview-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  color: #fffaf3;
  background: rgba(56, 38, 23, 0.72);
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}
.image-preview-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink);
}
