:root{
  --navy: #10142B;
  --navy-soft: #1B2044;
  --bg: #F2F3F8;
  --surface: #FFFFFF;
  --surface-alt: #F6F7FB;
  --ink: #10142B;
  --ink-soft: #5C6079;
  --ink-faint: #9497AC;
  --accent: #FF5A36;
  --accent-hover: #E24720;
  --accent-soft: #FFE6DD;
  --teal: #14B8A6;
  --border: #E4E5EF;
  --error: #D6455B;
  --error-soft: #FCE7EB;

  --font-display: "Space Grotesk", "Inter", sans-serif;
  --font-body: "Inter", -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", monospace;

  --radius: 12px;
}

*{ box-sizing: border-box; }

body{
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Hero ---------- */
.hero{
  background: var(--navy);
  background-image: radial-gradient(circle at 85% -10%, var(--navy-soft), transparent 55%);
  padding: 56px 20px 90px;
}
.hero__inner{
  max-width: 560px;
  margin: 0 auto;
}
.hero__badge{
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.03em;
  color: #C7CAE0;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px;
  padding: 6px 12px 6px 10px;
  margin-bottom: 20px;
}
.dot{
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--teal);
  flex-shrink: 0;
}
.hero__title{
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 42px;
  color: #fff;
  letter-spacing: -0.01em;
}
.hero__arrow{ color: var(--accent); }
.hero__sub{
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: #A7AAC4;
  max-width: 420px;
}

/* ---------- Shell / card ---------- */
.shell{
  max-width: 560px;
  margin: -56px auto 0;
  padding: 0 20px 60px;
}
.card{
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 24px 48px -24px rgba(16,20,43,0.35);
  padding: 30px;
}

.stage{ display: none; }
.stage[data-active="true"]{ display: block; }

/* ---------- Dropzone ---------- */
.dropzone{
  position: relative;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface-alt);
  padding: 40px 20px 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}
.dropzone:hover{ border-color: var(--accent); }
.dropzone:focus-visible{ outline: 2px solid var(--accent); outline-offset: 3px; }
.dropzone.is-dragover{
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: scale(1.01);
}

.dropzone__stack{
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 18px;
}
.chip{
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--surface);
}
.chip--doc{ color: var(--ink-soft); }
.chip--pdf{
  color: var(--accent-hover);
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: rotate(-4deg);
}

.dropzone__title{
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  color: var(--ink);
}
.dropzone__sub{
  margin: 0;
  font-size: 13.5px;
  color: var(--ink-soft);
}
.link-like{ color: var(--accent-hover); font-weight: 500; }

.hint{
  margin: 16px 2px 0;
  font-size: 12.5px;
  color: var(--ink-faint);
  line-height: 1.5;
}
.hint strong{ color: var(--ink-soft); }

/* ---------- File card ---------- */
.filecard{
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface-alt);
  margin-bottom: 18px;
}
.filecard__badge{
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  color: var(--accent-hover);
  background: var(--accent-soft);
  border-radius: 6px;
  padding: 5px 8px;
  flex-shrink: 0;
}
.filecard__meta{ flex: 1; min-width: 0; }
.filecard__name{
  margin: 0;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.filecard__size{
  margin: 2px 0 0;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-faint);
}
.iconbtn{
  width: 28px; height: 28px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--ink-faint);
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
}
.iconbtn:hover{ background: var(--border); color: var(--ink); }

/* ---------- Buttons ---------- */
.btn{
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 600;
  border-radius: var(--radius);
  border: none;
  padding: 14px 18px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
}
.btn:active{ transform: translateY(1px); }
.btn--full{ width: 100%; display: block; }
.btn--primary{
  background: var(--accent);
  color: #fff;
  box-shadow: 0 12px 24px -10px rgba(255,90,54,0.55);
}
.btn--primary:hover{ background: var(--accent-hover); }
.btn--ghost{
  background: transparent;
  color: var(--ink-soft);
  border: 1.5px solid var(--border);
  margin-top: 10px;
}
.btn--ghost:hover{ border-color: var(--ink-faint); color: var(--ink); }

/* ---------- Progress ---------- */
.progress{ padding: 6px 2px 4px; }
.progress__track{
  width: 100%;
  height: 10px;
  background: var(--surface-alt);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 12px;
}
.progress__fill{
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--teal));
  border-radius: 999px;
  transition: width 0.35s ease;
}
.progress__row{
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.progress__stage{
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-soft);
}
.progress__pct{
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent-hover);
  font-weight: 500;
}

/* ---------- Result ---------- */
.result{
  text-align: center;
  padding: 6px 4px 24px;
}
.result__badge{
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--teal);
  background: rgba(20,184,166,0.1);
  border-radius: 999px;
  padding: 6px 14px;
  margin-bottom: 12px;
}
.result__name{
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  color: var(--ink);
  word-break: break-all;
}

/* ---------- Error banner ---------- */
.error{
  margin-top: 18px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--error-soft);
  color: var(--error);
  border-radius: var(--radius);
  padding: 13px 14px;
  font-size: 13px;
  line-height: 1.5;
}
.error__mark{
  flex-shrink: 0;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--error);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.error p{ margin: 0; flex: 1; }
.error__close{
  background: none;
  border: none;
  color: var(--error);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

/* ---------- Foot note ---------- */
.foot-note{
  margin: 18px 4px 0;
  text-align: center;
  font-size: 12px;
  color: var(--ink-faint);
}

/* ---------- Off-screen render surface (used to build the PDF) ---------- */
#renderSurface{
  position: fixed;
  top: 0;
  left: -10000px;
  width: 794px;
  background: #ffffff;
  z-index: -1;
}
#renderSurface .docbody{
  width: 794px;
  padding: 56px 64px;
  font-family: "Georgia", "Times New Roman", serif;
  font-size: 14px;
  line-height: 1.55;
  color: #16181d;
  background: #ffffff;
}
#renderSurface h1, #renderSurface h2, #renderSurface h3, #renderSurface h4{
  font-family: "Georgia", serif;
  font-weight: 700;
  color: #101216;
  margin: 1.1em 0 0.5em;
  line-height: 1.3;
}
#renderSurface h1{ font-size: 24px; }
#renderSurface h2{ font-size: 19px; }
#renderSurface h3{ font-size: 16px; }
#renderSurface p{ margin: 0 0 0.85em; }
#renderSurface ul, #renderSurface ol{ margin: 0 0 0.85em; padding-left: 1.4em; }
#renderSurface li{ margin-bottom: 0.3em; }
#renderSurface table{ border-collapse: collapse; width: 100%; margin: 0 0 1em; }
#renderSurface td, #renderSurface th{ border: 1px solid #ccc; padding: 6px 8px; font-size: 13px; }
#renderSurface img{ max-width: 100%; height: auto; }
#renderSurface a{ color: #E24720; }
#renderSurface strong{ font-weight: 700; }
#renderSurface em{ font-style: italic; }
#renderSurface blockquote{
  margin: 0 0 0.85em;
  padding-left: 14px;
  border-left: 3px solid #ccc;
  color: #444;
}

/* ---------- Responsive ---------- */
@media (max-width: 520px){
  .hero{ padding: 44px 16px 80px; }
  .hero__title{ font-size: 32px; }
  .shell{ margin-top: -46px; padding: 0 16px 48px; }
  .card{ padding: 22px; }
}

@media (prefers-reduced-motion: reduce){
  *{ transition: none !important; }
}
