:root {
  --ink: #18221d;
  --muted: #647168;
  --paper: #fff9ef;
  --card: rgba(255, 255, 255, 0.82);
  --line: rgba(24, 34, 29, 0.14);
  --accent: #f07b43;
  --accent-strong: #c64c1e;
  --mint: #4fb58b;
  --shadow: 0 22px 70px rgba(38, 40, 32, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: "Aptos", "Microsoft YaHei UI", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 18% 12%, rgba(240, 123, 67, 0.12), transparent 30%),
    radial-gradient(circle at 88% 0%, rgba(79, 181, 139, 0.14), transparent 28%),
    linear-gradient(135deg, #fbf7ef 0%, #f2f6ef 58%, #faf4ec 100%);
}

body::before {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
  background-image: linear-gradient(rgba(24, 34, 29, 0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(24, 34, 29, 0.035) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: linear-gradient(to bottom, black, transparent 54%);
}

.shell {
  position: relative;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 48px;
}

.hero {
  margin-bottom: 22px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.topbar span,
.topbar a {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-decoration: none;
  text-transform: uppercase;
}

.topbar a {
  color: var(--muted);
  letter-spacing: 0.06em;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 560px;
  margin-bottom: 12px;
  font-size: clamp(34px, 4vw, 54px);
  font-weight: 850;
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.hero-copy {
  max-width: 660px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
}

.compact-hero {
  max-width: 760px;
}

.config-shell {
  width: min(760px, calc(100% - 32px));
}

.panel {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.config-page {
  padding: 24px;
}

.app-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
  gap: 26px;
  padding: 24px;
}

.form-card,
.result-card {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.62);
}

.config-page .form-card {
  background: rgba(255, 255, 255, 0.7);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.section-title span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  background: var(--ink);
}

.section-title h2 {
  margin: 0;
  font-size: 22px;
}

.spaced {
  margin-top: 28px;
}

label {
  display: grid;
  gap: 9px;
  margin-bottom: 16px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 14px;
  color: var(--ink);
  font: inherit;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.88);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(240, 123, 67, 0.16);
}

.drop-zone {
  min-height: 146px;
  place-items: center;
  padding: 24px;
  border: 2px dashed rgba(24, 34, 29, 0.22);
  border-radius: 22px;
  text-align: center;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.78), rgba(255, 243, 223, 0.74));
  cursor: pointer;
}

.drop-zone input {
  display: none;
}

.drop-zone strong {
  font-size: 18px;
}

.drop-zone small,
.muted {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.7;
}

.image-preview,
.video-preview {
  width: 100%;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: #101411;
}

.image-preview {
  max-height: 260px;
  margin-bottom: 14px;
  object-fit: contain;
}

.video-preview {
  margin-top: 18px;
  aspect-ratio: 9 / 16;
}

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

.config {
  margin: 10px 0 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.52);
}

.config-hint a {
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: none;
}

.config summary {
  margin-bottom: 14px;
  font-weight: 900;
  cursor: pointer;
}

.primary,
.secondary,
.download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  border: 0;
  border-radius: 999px;
  padding: 0 22px;
  color: #fff;
  font: inherit;
  font-weight: 900;
  text-decoration: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  box-shadow: 0 16px 26px rgba(198, 76, 30, 0.24);
  cursor: pointer;
}

.primary {
  width: 100%;
}

.secondary {
  width: 100%;
  min-height: 44px;
  margin-bottom: 10px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  box-shadow: none;
}

.primary:disabled {
  opacity: 0.64;
  cursor: wait;
}

.download {
  width: 100%;
  margin-top: 14px;
  background: linear-gradient(135deg, var(--mint), #1d7f5d);
}

.status-box {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 249, 239, 0.8);
}

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

.progress {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(24, 34, 29, 0.1);
}

.progress span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--mint));
  transition: width 0.3s ease;
}

.debug {
  margin-top: 20px;
}

.debug h3 {
  margin-bottom: 10px;
  font-size: 16px;
}

pre {
  max-height: 360px;
  overflow: auto;
  margin: 0;
  padding: 16px;
  border-radius: 18px;
  color: #f8f6ef;
  font-size: 12px;
  line-height: 1.6;
  background: #18221d;
}

.hidden {
  display: none;
}

@media (max-width: 900px) {
  .app-grid,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .shell {
    width: min(100% - 20px, 1180px);
    padding: 28px 0;
  }

  .app-grid,
  .form-card,
  .result-card {
    padding: 16px;
  }
}
