:root {
  --ink: #17221e;
  --muted: #66716c;
  --paper: #f8f5ec;
  --canvas: #e9ede8;
  --orange: #d65732;
  --orange-dark: #ad3c1c;
  --line: #bfc7c1;
  --white: #fffef9;
}

* { box-sizing: border-box; }
html { background: var(--canvas); }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 85% 5%, rgba(214,87,50,.13), transparent 28rem),
    var(--canvas);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Noto Sans TC", sans-serif;
  overflow-x: hidden;
}
button, textarea, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.site-header, .site-footer {
  max-width: 1180px;
  margin: auto;
  padding: 22px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 850; }
.brand-mark {
  width: 36px; height: 36px; display: grid; place-items: center;
  background: var(--ink); color: var(--paper); font-size: 11px; letter-spacing: .06em;
}
.preview-badge, .step, .eyebrow {
  font-size: 11px; font-weight: 850; letter-spacing: .16em; color: var(--orange);
}
.shell { width: min(1120px, calc(100% - 40px)); margin: 24px auto 80px; }
.hero { max-width: 920px; padding: 68px 0 54px; }
.hero h1 {
  margin: 12px 0 22px;
  font-family: Georgia, "Noto Serif TC", serif;
  font-size: clamp(48px, 8vw, 94px);
  line-height: .98;
  letter-spacing: -.045em;
  font-weight: 600;
}
.hero h1 em { color: var(--orange); font-style: normal; }
.hero-copy { max-width: 650px; font-size: 19px; line-height: 1.7; color: var(--muted); }
.zero-cost-note {
  display: inline-block; margin-top: 12px; padding: 9px 12px;
  border: 1px solid var(--line); background: rgba(255,255,255,.42);
  font-size: 12px; font-weight: 700;
}

.composer, .progress-panel, .error-panel, .results {
  background: var(--white); border: 1px solid rgba(23,34,30,.15);
  box-shadow: 0 18px 50px rgba(30,48,40,.08);
}
.composer { padding: clamp(24px, 5vw, 52px); }
.section-heading, .result-toolbar, .progress-copy, .verification-row {
  display: flex; justify-content: space-between; align-items: center; gap: 20px;
}
.section-heading h2, .result-toolbar h2, .podcast-card h2 { margin: 4px 0 0; font-size: 28px; }
.counter { font: 800 14px ui-monospace, monospace; color: var(--muted); }
textarea {
  width: 100%; resize: vertical; margin-top: 28px; padding: 20px;
  border: 1px solid var(--line); border-radius: 0; background: var(--paper);
  color: var(--ink); line-height: 1.7; outline: none;
}
textarea:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(214,87,50,.1); }
.field-help { margin: 10px 0 24px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.consent-row { display: flex; align-items: flex-start; gap: 12px; font-size: 14px; line-height: 1.6; }
.consent-row input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--orange); }
.verification-row { margin-top: 28px; padding-top: 28px; border-top: 1px solid var(--line); }
#generate {
  border: 0; padding: 17px 22px; min-width: 250px; display: flex;
  align-items: center; justify-content: space-between; gap: 30px;
  background: var(--orange); color: white; font-weight: 800;
}
#generate:hover { background: var(--orange-dark); }
#generate:disabled { cursor: wait; opacity: .6; }

.progress-panel, .error-panel { margin-top: 20px; padding: 28px 34px; }
.progress-track { margin-top: 15px; height: 7px; background: #dfe4df; overflow: hidden; }
#progress-bar { width: 0; height: 100%; background: var(--orange); transition: width .35s ease; }
#progress-detail, .error-panel p { margin: 12px 0 0; color: var(--muted); }
.error-panel { border-left: 5px solid #ad2e23; }

.results { margin-top: 30px; padding: clamp(20px, 4vw, 42px); }
.result-toolbar { margin-bottom: 28px; }
.download-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.secondary {
  padding: 11px 15px; border: 1px solid var(--ink); background: transparent; font-weight: 750;
}
.secondary:hover:not(:disabled) { background: var(--ink); color: white; }
.secondary:disabled { opacity: .45; cursor: not-allowed; }

.report-page {
  width: min(100%, 210mm); min-height: 297mm; margin: auto; padding: 13mm 14mm 11mm;
  background: var(--paper); border: 1px solid rgba(23,34,30,.1); overflow: hidden;
}
.report-header { border-bottom: 3px solid var(--ink); padding-bottom: 5mm; margin-bottom: 5mm; }
.report-header > span { color: var(--orange); font-size: 10px; font-weight: 850; letter-spacing: .16em; }
.report-header h2 {
  margin: 2mm 0; font: 600 29px/1.08 Georgia, "Noto Serif TC", serif; letter-spacing: -.02em;
}
.report-header p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.report-highlights { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 4mm; }
.report-highlight { border-top: 1px solid #aab3ae; padding-top: 3mm; min-width: 0; }
.report-highlight h3 { margin: 0 0 2mm; font: 600 16px/1.25 Georgia, "Noto Serif TC", serif; }
.report-highlight p { margin: 0; font-size: 11px; line-height: 1.58; }
.refs { margin-top: 2mm; color: var(--orange); font-size: 9px; font-weight: 800; }
.refs a { color: var(--orange); text-decoration: none; }
.report-sources { border-top: 2px solid var(--ink); margin-top: 6mm; padding-top: 4mm; }
.report-sources > h3 { margin: 0 0 2mm; font-size: 11px; letter-spacing: .1em; }
.source-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 2.5mm 6mm; }
.report-source { font-size: 9px; line-height: 1.35; overflow-wrap: anywhere; }
.report-source a { font-weight: 800; text-decoration: none; }
.report-page > footer { margin-top: 5mm; color: var(--muted); font-size: 8px; }

.podcast-card, .source-status-card {
  margin-top: 24px; padding: 28px; border: 1px solid var(--line); background: #f3f0e7;
}
.podcast-card { display: grid; grid-template-columns: 1fr minmax(280px, 1fr); gap: 28px; align-items: center; }
.podcast-card p { color: var(--muted); }
audio { width: 100%; }
.source-status-card h3 { margin-top: 0; }
.source-status {
  display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--line); font-size: 13px;
}
.status-success { color: #176c45; }
.status-failed { color: #9b2c22; }
.status-skipped { color: #9a6412; }
#retention-note { color: var(--muted); font-size: 12px; }
.site-footer { border-top: 1px solid rgba(23,34,30,.14); color: var(--muted); font-size: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 760px) {
  .site-header, .site-footer { padding: 18px 20px; }
  .preview-badge { display: none; }
  .shell { width: min(100% - 24px, 1120px); margin-top: 0; }
  .hero { padding: 44px 4px 36px; }
  .hero h1 { font-size: clamp(43px, 14vw, 65px); }
  .section-heading, .result-toolbar, .verification-row { align-items: stretch; flex-direction: column; }
  #generate { width: 100%; }
  .download-actions { width: 100%; }
  .download-actions button { flex: 1; }
  .report-page { width: 100%; min-height: auto; padding: 24px 18px; }
  .report-highlights, .source-grid { grid-template-columns: 1fr; }
  .report-highlight { padding-top: 14px; }
  .podcast-card { grid-template-columns: 1fr; }
  .source-status { grid-template-columns: 36px 1fr; }
  .source-status span:last-child { grid-column: 2; }
  .site-footer { align-items: flex-start; flex-direction: column; gap: 8px; }
}

@media print {
  body { background: white; }
  .site-header, .hero, .composer, .progress-panel, .error-panel,
  .result-toolbar, .podcast-card, .source-status-card, .site-footer { display: none !important; }
  .shell, .results { width: auto; margin: 0; padding: 0; border: 0; box-shadow: none; }
  .report-page { width: 210mm; height: 297mm; margin: 0; border: 0; }
}
