:root {
  --paper: #f4edde;
  --paper-deep: #eadfca;
  --ink: #2f5246;
  --ink-soft: #63786e;
  --accent: #d8c7ae;
  --line: rgba(47, 82, 70, 0.14);
  --panel: rgba(255, 251, 245, 0.82);
  --panel-strong: rgba(255, 255, 255, 0.72);
  --shadow: 0 16px 42px rgba(113, 93, 71, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Hiragino Sans GB", "PingFang SC", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(221, 205, 182, 0.45), transparent 30%),
    radial-gradient(circle at bottom right, rgba(210, 226, 214, 0.38), transparent 28%),
    var(--paper);
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

input,
textarea,
button,
.link-button,
select {
  font: inherit;
}

button,
.link-button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  text-decoration: none;
}

button.primary {
  background: var(--ink);
  color: #fffdf7;
}

button.secondary,
button:not(.primary):not(.nav-item),
.link-button,
#copyPromptBtnSingle,
#downloadPromptBtnSingle {
  background: rgba(47, 82, 70, 0.08);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid rgba(47, 82, 70, 0.18);
  border-radius: 16px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
}

textarea {
  resize: vertical;
}

.app-shell {
  width: min(1540px, calc(100vw - 28px));
  margin: 14px auto;
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.sidebar,
.panel,
.task-bar,
.restore-banner {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.sidebar {
  position: sticky;
  top: 14px;
  min-height: calc(100vh - 28px);
  padding: 22px 18px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
}

.sidebar-brand,
.sidebar-footer {
  padding: 8px 6px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--ink-soft);
  letter-spacing: 0.08em;
  font-size: 12px;
}

.sidebar h1,
.task-bar h2,
.section-head h3 {
  margin: 0;
  font-weight: 800;
}

.sidebar h1 {
  font-size: 28px;
  line-height: 1.15;
}

.sidebar-intro,
.task-subtitle,
.tip,
.status,
.meta,
.result-frame p,
#coverPlaceholder,
.empty-batch,
.restore-copy span {
  color: var(--ink-soft);
}

.sidebar-intro,
.task-subtitle {
  margin: 10px 0 0;
  line-height: 1.7;
  font-size: 14px;
}

.sidebar-nav {
  display: grid;
  gap: 10px;
}

.nav-item {
  width: 100%;
  padding: 14px 16px;
  border-radius: 20px;
  border: 1px solid rgba(47, 82, 70, 0.1);
  background:
    radial-gradient(circle at top right, rgba(216, 199, 174, 0.15), transparent 30%),
    rgba(255, 255, 255, 0.56);
  text-align: left;
  display: grid;
  gap: 6px;
}

.nav-item strong {
  font-size: 15px;
  color: var(--ink);
}

.nav-item span {
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink-soft);
}

.nav-item.active {
  background:
    radial-gradient(circle at top right, rgba(216, 199, 174, 0.24), transparent 30%),
    rgba(47, 82, 70, 0.09);
  border-color: rgba(47, 82, 70, 0.2);
  box-shadow: 0 10px 24px rgba(47, 82, 70, 0.08);
}

.nav-item.disabled {
  opacity: 0.6;
}

.workspace-shell {
  min-width: 0;
  display: grid;
  gap: 18px;
}

.site-record-footer {
  margin-top: 2px;
  padding: 0 4px 8px;
}

.site-record-footer__inner {
  padding: 14px 18px;
  border-radius: 22px;
  border: 1px solid rgba(47, 82, 70, 0.1);
  background: rgba(255, 251, 245, 0.68);
  display: grid;
  gap: 8px;
}

.site-record-footer__title {
  margin: 0;
  font-size: 13px;
  color: var(--ink-soft);
}

.site-record-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-soft);
}

.site-record-footer__link {
  color: var(--ink);
  text-decoration: none;
}

.site-record-footer__link:hover {
  text-decoration: underline;
}

.site-record-footer__divider {
  color: rgba(47, 82, 70, 0.35);
}

.site-record-footer__hint {
  color: var(--ink-soft);
}

.restore-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
}

.restore-copy {
  display: grid;
  gap: 6px;
}

.task-bar {
  padding: 22px 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
}

.task-bar-copy h2 {
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.08;
}

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

.workspace-panel {
  display: none;
}

.workspace-panel.active {
  display: block;
}

.workspace-grid {
  display: grid;
  gap: 18px;
  align-items: start;
}

.banner-grid,
.batch-grid,
.reading-list-grid {
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
}

.template-page-grid {
  grid-template-columns: minmax(320px, 0.88fr) minmax(420px, 1.12fr);
}

.settings-page-grid {
  grid-template-columns: minmax(0, 1fr);
}

.workspace-main-column,
.workspace-side-column {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.panel {
  padding: 24px;
  min-width: 0;
}

.production-panel,
.scenario-panel,
.preview-panel,
.result-panel,
.batch-result-panel,
.template-list-panel,
.template-detail-panel,
.settings-page-panel {
  min-height: 100%;
}

.section-head,
.prompt-head {
  display: flex;
  gap: 14px;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
}

.section-inline-bar {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.result-summary-row {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.result-summary-chip {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(47, 82, 70, 0.1);
  background: rgba(255, 255, 255, 0.72);
  display: grid;
  gap: 4px;
}

.result-summary-chip.clickable {
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.result-summary-chip.clickable:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(113, 93, 71, 0.08);
  border-color: rgba(47, 82, 70, 0.18);
}

.result-summary-chip strong {
  font-size: 24px;
  line-height: 1;
}

.result-summary-chip span {
  color: var(--ink-soft);
  font-size: 13px;
}

.result-group {
  margin-top: 16px;
  padding: 14px 16px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(47, 82, 70, 0.08);
}

.result-group-head {
  margin-top: 0;
}

.section-head h3 {
  font-size: 24px;
  line-height: 1.18;
}

.field {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.field span {
  font-size: 14px;
  color: var(--ink-soft);
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.actions.compact {
  margin-top: 0;
}

.mode-switch {
  display: inline-flex;
  gap: 8px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(47, 82, 70, 0.08);
  margin-top: 16px;
}

.tab-button {
  background: transparent;
  color: var(--ink-soft);
  padding: 10px 16px;
}

.tab-button.active {
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  box-shadow: 0 4px 12px rgba(113, 93, 71, 0.08);
}

.compact-panel {
  padding: 20px 24px;
}

.section-summary {
  cursor: pointer;
  list-style: none;
  color: var(--ink);
  font-weight: 700;
}

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

.section-mini-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 12px 0 8px;
}

.section-mini-head strong {
  font-size: 16px;
}

.section-mini-head span {
  color: var(--ink-soft);
  font-size: 13px;
}

.scenario-card {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 22px;
  background:
    radial-gradient(circle at top right, rgba(216, 199, 174, 0.18), transparent 28%),
    rgba(255, 255, 255, 0.64);
  border: 1px solid rgba(47, 82, 70, 0.12);
  display: grid;
  gap: 12px;
}

.selection-feedback {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(94, 141, 122, 0.14);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.scenario-copy {
  display: grid;
  gap: 6px;
}

.scenario-copy strong {
  font-size: 17px;
}

.scenario-copy span {
  line-height: 1.65;
}

.inline-size-field {
  margin-top: 0;
}

.template-inline-preview {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(47, 82, 70, 0.1);
}

.template-inline-label {
  display: block;
  margin-bottom: 8px;
  color: var(--ink-soft);
  font-size: 12px;
}

.template-inline-text {
  margin: 0;
  color: var(--ink);
  line-height: 1.7;
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cover-frame,
.result-frame {
  margin-top: 18px;
  min-height: 320px;
  border-radius: 24px;
  border: 1px dashed rgba(47, 82, 70, 0.2);
  background:
    radial-gradient(circle at 80% 18%, rgba(185, 210, 196, 0.26), transparent 18%),
    radial-gradient(circle at 18% 80%, rgba(224, 202, 177, 0.34), transparent 20%),
    rgba(255, 255, 255, 0.42);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.cover-frame img,
.result-frame img {
  max-width: 100%;
  max-height: 100%;
  display: block;
}

.meta {
  margin-top: 12px;
  display: grid;
  gap: 6px;
  font-size: 13px;
}

.prompt-output {
  margin-top: 16px;
  min-height: 340px;
  line-height: 1.7;
}

.batch-panel {
  margin-top: 10px;
  padding: 18px;
  border-radius: 22px;
  background:
    radial-gradient(circle at top right, rgba(216, 199, 174, 0.12), transparent 28%),
    rgba(255, 255, 255, 0.5);
  border: 1px solid var(--line);
}

.batch-head {
  display: grid;
  gap: 6px;
  margin-top: 18px;
}

.queue-filter-bar {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.batch-search-field {
  margin-top: 14px;
}

.queue-filter-chip {
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(47, 82, 70, 0.06);
  border: 1px solid rgba(47, 82, 70, 0.08);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
}

.queue-filter-chip.active {
  background: rgba(47, 82, 70, 0.14);
  color: var(--ink);
  border-color: rgba(47, 82, 70, 0.18);
}

.batch-tools {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 8px;
}

.batch-summary-panel {
  margin-top: 16px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid rgba(47, 82, 70, 0.12);
}

.summary-card {
  display: grid;
  gap: 6px;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--line);
}

.summary-card span {
  color: var(--ink-soft);
  font-size: 14px;
}

.progress-track {
  width: 100%;
  height: 12px;
  margin-top: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(47, 82, 70, 0.08);
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5e8d7a 0%, #88b39a 100%);
  transition: width 180ms ease;
}

.batch-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 16px;
  max-height: 560px;
  overflow: auto;
  padding-right: 6px;
}

.batch-item,
.batch-result-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(47, 82, 70, 0.1);
}

.compact-batch-item {
  gap: 10px;
  padding: 12px;
}

.batch-item-top {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.batch-thumb {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid rgba(47, 82, 70, 0.12);
  background: #fff;
}

.batch-thumb-placeholder {
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  font-size: 12px;
  background:
    linear-gradient(135deg, rgba(236, 225, 207, 0.92), rgba(246, 240, 229, 0.98));
}

.batch-item-meta,
.batch-result-meta {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.batch-item-more {
  border-top: 1px solid rgba(47, 82, 70, 0.08);
  padding-top: 8px;
}

.batch-item-more summary {
  cursor: pointer;
  list-style: none;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
}

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

.batch-item-more-body {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.batch-filename {
  color: var(--ink-soft);
  font-size: 13px;
  word-break: break-all;
}

.batch-title-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(47, 82, 70, 0.16);
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
}

.batch-item-meta strong,
.batch-result-meta strong {
  font-size: 16px;
}

.batch-item-meta span,
.batch-result-meta span,
.empty-batch {
  font-size: 14px;
}

.status-pill {
  display: inline-flex;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(47, 82, 70, 0.08);
  color: var(--ink);
}

.status-pill.running {
  background: rgba(221, 171, 74, 0.16);
}

.status-pill.done {
  background: rgba(98, 159, 118, 0.16);
}

.status-pill.error {
  background: rgba(187, 91, 91, 0.14);
}

.status-pill.source {
  background: rgba(47, 82, 70, 0.08);
}

.status-pill.source.cover {
  background: rgba(98, 159, 118, 0.16);
}

.status-pill.source.filename {
  background: rgba(72, 124, 163, 0.14);
}

.status-pill.source.fallback {
  background: rgba(221, 171, 74, 0.16);
}

.batch-result-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  max-height: 360px;
  overflow: auto;
  align-content: start;
  padding-right: 6px;
}

.batch-result-image {
  width: 100%;
  border-radius: 16px;
  display: block;
  border: 1px solid rgba(47, 82, 70, 0.12);
}

.generated-library {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid rgba(47, 82, 70, 0.08);
}

.reading-list-form-grid,
.reading-list-source-grid {
  display: grid;
  gap: 16px;
}

.reading-list-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.reading-list-source-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 16px;
}

.batch-import-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.source-card,
.brief-card {
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(47, 82, 70, 0.1);
}

.source-card {
  display: grid;
  gap: 8px;
}

.source-card strong,
.brief-card strong {
  font-size: 16px;
}

.source-card p,
.brief-text {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.7;
}

.brief-card {
  margin-top: 18px;
  display: grid;
  gap: 8px;
}

.reading-list-books-head {
  margin-top: 18px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.template-library-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  max-height: 72vh;
  overflow: auto;
}

.template-choice-card {
  width: 100%;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(47, 82, 70, 0.12);
  background:
    radial-gradient(circle at top right, rgba(216, 199, 174, 0.14), transparent 28%),
    rgba(255, 255, 255, 0.72);
  text-align: left;
  display: grid;
  gap: 8px;
}

.template-choice-card strong {
  font-size: 15px;
}

.template-choice-card span {
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.55;
}

.template-card-description {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.template-choice-card.active {
  border-color: rgba(47, 82, 70, 0.26);
  background:
    radial-gradient(circle at top right, rgba(216, 199, 174, 0.24), transparent 28%),
    rgba(47, 82, 70, 0.08);
  box-shadow: 0 12px 28px rgba(47, 82, 70, 0.08);
}

.template-source-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(47, 82, 70, 0.08);
  color: var(--ink);
  font-size: 12px;
  white-space: nowrap;
}

.template-tag-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.template-tag-row em {
  font-style: normal;
  font-size: 11px;
  color: var(--ink);
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(47, 82, 70, 0.08);
}

.template-prompt-reading {
  margin-top: 6px;
}

.template-prompt-scroll {
  max-height: 260px;
  overflow: auto;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(47, 82, 70, 0.1);
  color: var(--ink);
  line-height: 1.8;
  white-space: pre-wrap;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 14px;
}

.settings-grid-wide {
  grid-column: 1 / -1;
}

.settings-summary {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.input-with-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.inline-button {
  padding: 12px 14px;
  background: rgba(47, 82, 70, 0.08);
  color: var(--ink);
}

.settings-feedback {
  margin: 12px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
}

.hidden {
  display: none !important;
}

@media (max-width: 1280px) {
  .app-shell {
    grid-template-columns: 256px minmax(0, 1fr);
  }

  .task-bar {
    grid-template-columns: 1fr;
  }

  .task-bar-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 1040px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    min-height: auto;
  }

  .banner-grid,
  .batch-grid,
  .reading-list-grid,
  .template-page-grid {
    grid-template-columns: 1fr;
  }

  .task-bar-stats,
  .batch-result-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .reading-list-form-grid,
  .reading-list-source-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100vw - 18px, 1540px);
    margin: 9px auto 16px;
  }

  .sidebar,
  .panel,
  .task-bar,
  .restore-banner {
    border-radius: 22px;
  }

  .restore-banner {
    display: grid;
  }

  .batch-list,
  .batch-result-grid {
    grid-template-columns: 1fr;
  }
}
