:root {
  --bg: #f6f7f5;
  --surface: #ffffff;
  --surface-2: #fbfcfb;
  --ink: #1c2420;
  --muted: #6b776f;
  --faint: #95a098;
  --line: #e6ebe7;
  --line-strong: #d3dbd5;
  --brand: #2f6f5e;
  --brand-ink: #1f4d41;
  --brand-soft: #e8f2ee;
  --danger: #a94442;
  --danger-soft: #f8eceb;
  --ok: #2f6f5e;
  --ok-soft: #e8f2ee;
  --warn: #8a6d3b;
  --warn-soft: #f7f1e6;
  --shadow: 0 12px 40px rgba(28, 36, 32, 0.06);
  --radius: 16px;
  --radius-sm: 10px;
  --space: 20px;
  --dock-h: 84px;
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(1200px 480px at 10% -10%, rgba(47, 111, 94, 0.08), transparent 60%),
    radial-gradient(900px 420px at 100% 0%, rgba(28, 36, 32, 0.04), transparent 55%),
    var(--bg);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
}

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

button {
  cursor: pointer;
}

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

[hidden] {
  display: none !important;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
.dropzone:focus-visible {
  outline: 3px solid rgba(47, 111, 94, 0.22);
  outline-offset: 2px;
}

.page {
  min-height: 100vh;
  padding-bottom: calc(var(--dock-h) + 28px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 22px 24px 8px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.brand-text strong,
.brand-text small {
  display: block;
}

.brand-text strong {
  font-size: 16px;
  line-height: 1.2;
}

.brand-text small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.status-pill[data-tone="ready"] {
  background: var(--ok-soft);
  border-color: transparent;
  color: var(--brand-ink);
}

.status-pill[data-tone="busy"] {
  background: var(--warn-soft);
  border-color: transparent;
  color: var(--warn);
}

.status-pill[data-tone="error"] {
  background: var(--danger-soft);
  border-color: transparent;
  color: var(--danger);
}

.status-pill[data-tone="done"] {
  background: var(--ok-soft);
  border-color: transparent;
  color: var(--brand-ink);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 20px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 12px 24px 0;
  align-items: start;
}

.main-panel,
.side {
  min-width: 0;
}

.hero {
  margin: 8px 0 22px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.hero h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.lede {
  max-width: 36em;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.card,
.side-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card {
  min-width: 0;
  overflow: hidden;
  padding: 22px;
  margin-bottom: 16px;
}

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

.step {
  margin: 0 0 4px;
  color: var(--faint);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.card h2,
.side-card h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
}

.card-note,
.muted {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.grid {
  display: grid;
  gap: 14px;
}

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

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

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field-inline {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.field-inline .label {
  white-space: nowrap;
}

.field-inline input {
  width: 72px;
}

.label {
  color: var(--muted);
  font-size: 12px;
}

.label em {
  margin-left: 2px;
  color: var(--faint);
  font-style: normal;
}

input[type="text"],
input[type="number"],
select {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  transition: border-color 0.15s ease, background 0.15s ease;
}

input:hover,
select:hover {
  border-color: #c4cec7;
}

input:focus,
select:focus {
  border-color: var(--brand);
  background: #fff;
}

input:disabled,
select:disabled {
  background: #f0f2f0;
  color: var(--faint);
}

.option-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 18px;
  margin-top: 14px;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 13px;
}

.check input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
}

.check-block {
  align-items: flex-start;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.check-block strong,
.check-block small {
  display: block;
}

.check-block strong {
  font-size: 13px;
  font-weight: 600;
}

.check-block small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.layout-extra {
  margin-top: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  min-width: 132px;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
  background: var(--brand-ink);
}

.btn-secondary {
  background: var(--brand-soft);
  color: var(--brand-ink);
  border-color: transparent;
}

.btn-secondary:hover:not(:disabled) {
  background: #d9ebe4;
}

.btn-ghost {
  border-color: var(--line-strong);
  background: #fff;
  color: var(--ink);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-2);
}

.dropzone {
  display: block;
  min-width: 0;
  overflow: hidden;
  padding: 8px;
  border: 1px dashed #c8d4cd;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(47, 111, 94, 0.03), transparent 50%),
    var(--surface-2);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.dropzone.has-file {
  border-style: solid;
  border-color: var(--line);
  background: #fff;
}

.dropzone-body {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 28px 16px;
  text-align: center;
}

.drop-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 4px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--brand);
  font-size: 18px;
  font-weight: 700;
}

.dropzone-body strong {
  font-size: 15px;
}

.dropzone-body > span {
  color: var(--muted);
  font-size: 13px;
}

.dropzone-body .btn {
  margin-top: 8px;
}

.file-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 12px;
  min-width: 0;
  overflow: hidden;
}

.file-card-main {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.file-card-main > div {
  min-width: 0;
  flex: 1;
}

.file-ext {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-size: 11px;
  font-weight: 800;
}

.file-card .btn {
  flex: 0 0 auto;
  margin-top: 1px;
}

.file-card-main strong,
.file-card-main span {
  display: block;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.file-card-main strong {
  font-size: 14px;
  line-height: 1.4;
}

.file-card-main span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.preview {
  margin-top: 16px;
  min-height: 160px;
  max-height: 280px;
  overflow: auto;
  padding: 14px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.empty-state,
.preview-message {
  color: var(--muted);
  font-size: 13px;
}

.error-message {
  padding: 12px;
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
}

.preview-header strong {
  color: var(--ink);
  font-size: 13px;
}

.chapter-list {
  margin: 0;
  padding-left: 18px;
}

.chapter-list li {
  padding: 4px 0;
  color: var(--ink);
  font-size: 13px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.chapter-list li.more {
  color: var(--muted);
}

.side {
  display: grid;
  gap: 14px;
  position: sticky;
  top: 18px;
}

.side-card {
  padding: 18px;
}

.side-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 600;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-size: 12px;
  font-weight: 600;
}

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.step-item {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: start;
  opacity: 0.55;
}

.step-item.active,
.step-item.done {
  opacity: 1;
}

.step-dot {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #eef1ef;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.step-item.active .step-dot {
  background: var(--brand);
  color: #fff;
}

.step-item.done .step-dot {
  background: var(--brand-soft);
  color: var(--brand-ink);
}

.step-item strong,
.step-item small {
  display: block;
}

.step-item strong {
  font-size: 13px;
  font-weight: 600;
}

.step-item small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.summary {
  margin: 0;
  display: grid;
  gap: 10px;
}

.summary > div {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 8px;
}

.summary dt {
  color: var(--muted);
  font-size: 12px;
}

.summary dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.result-card {
  background:
    linear-gradient(180deg, rgba(47, 111, 94, 0.06), transparent 42%),
    var(--surface);
}

.result-card.is-error {
  background:
    linear-gradient(180deg, rgba(169, 68, 66, 0.08), transparent 42%),
    var(--surface);
}

.result-kicker {
  margin: 0 0 6px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 600;
}

.result-card.is-error .result-kicker {
  color: var(--danger);
}

.result-card h2 {
  margin-bottom: 6px;
  font-size: 18px;
}

.result-actions {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.download-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
}

.download-link:hover {
  background: var(--brand-ink);
}

.download-link.secondary {
  background: #fff;
  color: var(--brand-ink);
  border: 1px solid var(--line-strong);
}

.download-link.secondary:hover {
  background: var(--surface-2);
}

.action-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--dock-h);
  padding: 14px max(24px, calc((100vw - 1120px) / 2 + 24px));
  background: rgba(255, 255, 255, 0.92);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.action-copy {
  min-width: 0;
}

.action-copy strong,
.action-copy span {
  display: block;
}

.action-copy strong {
  font-size: 14px;
}

.action-copy span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.footer {
  max-width: 1120px;
  margin: 18px auto 0;
  padding: 0 24px 8px;
  color: var(--faint);
  font-size: 12px;
  text-align: center;
}

@media (max-width: 920px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .side {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .result-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .topbar,
  .layout,
  .footer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .hero h1 {
    font-size: 24px;
  }

  .card {
    padding: 18px;
  }

  .card-head {
    flex-direction: column;
  }

  .grid-2,
  .grid-4,
  .side {
    grid-template-columns: 1fr;
  }

  .action-dock {
    flex-direction: column;
    align-items: stretch;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  }

  .action-copy span {
    white-space: normal;
  }

  .btn-primary {
    width: 100%;
  }

  .page {
    padding-bottom: calc(var(--dock-h) + 48px);
  }
}
