:root {
  /* Claude-inspired warm editorial palette (Clay / Cream / Ink) */
  --bg: #faf9f5;
  --surface: #f5f4ee;
  --surface-alt: #ebe9e0;
  --panel: #fefdfb;
  --text: #000000;
  --muted: #333330;
  --soft: #15150f;
  --line: #e4e1d7;
  --primary: #c96442;
  --primary-dark: #b45433;
  --primary-soft: #f4e5dc;
  --accent: #7a8b6f;
  --danger: #b0413e;
  --shadow-sm: 0 1px 2px rgba(38, 38, 37, 0.05);
  --shadow-md: 0 6px 20px rgba(38, 38, 37, 0.07);
  --shadow-lg: 0 16px 40px rgba(38, 38, 37, 0.09);
  --serif: "Fraunces", "Source Serif 4", "Times New Roman", "Yu Mincho", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", "Yu Gothic UI", sans-serif;
  --mono: "JetBrains Mono", "Consolas", "Yu Gothic UI", monospace;
  font-family: var(--sans);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(120% 60% at 50% -10%, #ffffff 0%, var(--bg) 42%, var(--surface) 100%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--sans);
  font-size: 19px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

.shell {
  width: min(960px, calc(100% - 40px));
  margin: 0 auto;
  padding: 72px 0 96px;
}

.hero {
  margin-bottom: 44px;
}

.eyebrow,
.step {
  margin: 0 0 10px;
  color: var(--primary);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 18ch;
  margin-bottom: 18px;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(34px, 5vw, 54px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text);
}

h2 {
  margin-bottom: 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 31px;
  line-height: 1.22;
  letter-spacing: -0.015em;
  color: var(--text);
}

h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 19px;
  letter-spacing: -0.01em;
}

.lead {
  max-width: 62ch;
  color: var(--soft);
  font-size: 21px;
  line-height: 1.75;
}

.hero-links {
  margin: 20px 0 0;
}

.hero-links a {
  display: inline-flex;
  align-items: center;
  padding: 9px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease, transform 0.15s ease;
}

.hero-links a:hover {
  background: #efd8cb;
  transform: translateY(-1px);
}

.panel {
  margin-top: 28px;
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow-md);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 4px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--soft);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}

.status-pill.done {
  border-color: rgba(122, 139, 111, 0.4);
  color: #4f6043;
  background: rgba(122, 139, 111, 0.12);
}

.dropzone {
  display: grid;
  place-items: center;
  min-height: 210px;
  border: 1.5px dashed var(--surface-alt);
  border-radius: 14px;
  background: var(--surface);
  color: var(--muted);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.dropzone:hover {
  border-color: var(--primary);
}

.dropzone strong {
  display: block;
  color: var(--text);
  font-family: var(--serif);
  font-weight: 500;
  font-size: 24px;
}

.dropzone span {
  display: block;
  margin-top: 6px;
  font-size: 17px;
  color: var(--soft);
}

.dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-soft);
  transform: translateY(-1px);
}

.path-row {
  display: grid;
  gap: 8px;
  margin-top: 20px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 14px;
  color: var(--text);
  background: var(--bg);
  font: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(201, 100, 66, 0.15);
}

textarea {
  resize: vertical;
  line-height: 1.6;
}

.advanced {
  margin-top: 22px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
}

.advanced summary {
  cursor: pointer;
  color: var(--primary);
  font-weight: 600;
  font-size: 15px;
  list-style: none;
}

.advanced summary::-webkit-details-marker {
  display: none;
}

.advanced summary::before {
  content: "+ ";
  font-weight: 700;
}

.advanced[open] summary::before {
  content: "− ";
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.settings-grid label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.summary {
  margin-top: 26px;
  padding-top: 4px;
}

.summary dl,
.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.summary dl {
  margin: 14px 0 0;
}

.summary dl div,
.metrics div {
  min-height: 92px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

dt,
.metrics span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

dd,
.metrics strong {
  display: block;
  margin: 8px 0 0;
  color: var(--text);
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 500;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
}

button,
.download {
  min-height: 48px;
  border-radius: 11px;
  padding: 11px 24px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.primary {
  border: 1px solid var(--primary);
  color: #fdf6f2;
  background: var(--primary);
  box-shadow: var(--shadow-sm);
}

.primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.primary:disabled {
  border-color: var(--surface-alt);
  color: var(--muted);
  background: var(--surface-alt);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.ghost,
.download {
  border: 1px solid var(--line);
  color: var(--soft);
  background: var(--bg);
}

.ghost:hover,
.download:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.progress-wrap {
  margin-top: 26px;
}

.progress-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-alt);
}

.progress-bar span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

#progress-label,
#cover-progress-label {
  margin: 10px 0 0;
  color: var(--soft);
  font-size: 16px;
  font-weight: 500;
}

/* Optional AI — visually secondary */
.ai-panel {
  background: var(--surface);
  border-color: var(--surface-alt);
  box-shadow: var(--shadow-sm);
}

.result-panel {
  border-color: rgba(122, 139, 111, 0.4);
}

.ai-output {
  margin-top: 22px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
}

.ai-output p {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 14px;
}

.ai-output pre {
  min-height: 120px;
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text);
  font: 14.5px/1.7 var(--mono);
}

.downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 26px 0;
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 24px, 960px);
    padding: 40px 0 64px;
  }

  .panel {
    padding: 24px;
    border-radius: 14px;
  }

  .panel-head,
  .settings-grid,
  .summary dl,
  .metrics {
    grid-template-columns: 1fr;
  }

  .panel-head {
    display: grid;
  }

  .dropzone {
    min-height: 170px;
  }
}
