:root {
  --bg: #f6f5f1;
  --bg-2: #efece4;
  --ink: #15140f;
  --ink-2: #4a463d;
  --line: #1a1916;
  --accent: #d9412e;
  --accent-2: #1a1916;
  --paper: #ffffff;
  --shadow: 0 30px 60px -30px rgba(20, 18, 14, 0.35);

  --radius: 14px;
  --radius-lg: 22px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image:
    radial-gradient(circle at 18% 12%, rgba(217, 65, 46, 0.08), transparent 45%),
    radial-gradient(circle at 82% 80%, rgba(20, 18, 14, 0.08), transparent 50%);
  mix-blend-mode: multiply;
}

.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px clamp(20px, 5vw, 56px);
  border-bottom: 1px solid rgba(20, 18, 14, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.brand .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(217, 65, 46, 0.15);
}

.brand-name {
  font-family: 'Fraunces', serif;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.meta {
  display: flex;
  gap: 8px;
}

.kbd {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 10px;
  border: 1px solid rgba(20, 18, 14, 0.18);
  border-radius: 999px;
  color: var(--ink-2);
  background: rgba(255, 255, 255, 0.5);
}

.hero {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  max-width: 980px;
  margin: 0 auto;
  padding: clamp(40px, 8vw, 96px) clamp(20px, 5vw, 40px) 60px;
  width: 100%;
}

.eyebrow {
  margin: 0 0 18px;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.title {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: clamp(40px, 7vw, 84px);
  line-height: 0.98;
  letter-spacing: -0.03em;
  margin: 0 0 26px;
}

.title em {
  font-style: italic;
  font-weight: 500;
}

.title .accent {
  color: var(--accent);
  font-style: italic;
}

.lede {
  max-width: 56ch;
  margin: 0 0 44px;
  font-size: clamp(16px, 1.4vw, 19px);
  line-height: 1.55;
  color: var(--ink-2);
}

.card {
  background: var(--paper);
  border: 1px solid rgba(20, 18, 14, 0.08);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.label {
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.field {
  display: flex;
  align-items: stretch;
  gap: 10px;
  background: var(--bg-2);
  border-radius: var(--radius);
  padding: 6px;
  border: 1px solid rgba(20, 18, 14, 0.08);
  transition: border-color 200ms var(--ease), background 200ms var(--ease);
}

.field:focus-within {
  border-color: rgba(20, 18, 14, 0.32);
  background: #fff;
}

.field input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 16px;
  padding: 14px 14px;
  color: var(--ink);
}

.field input::placeholder { color: rgba(20, 18, 14, 0.4); }

button#go {
  appearance: none;
  border: 0;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  font: inherit;
  font-weight: 600;
  letter-spacing: -0.01em;
  padding: 0 22px;
  min-height: 48px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: transform 180ms var(--ease), background 180ms var(--ease), opacity 180ms var(--ease);
  position: relative;
}

button#go:hover { background: var(--accent); }
button#go:active { transform: translateY(1px); }
button#go:disabled { cursor: not-allowed; opacity: 0.7; }

.btn-spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  display: none;
  animation: spin 700ms linear infinite;
}

button#go.loading .btn-spinner { display: inline-block; }
button#go.loading .btn-label::after { content: '…'; }

@keyframes spin { to { transform: rotate(360deg); } }

.hint {
  margin: 0;
  font-size: 13px;
  color: var(--ink-2);
}

.status {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  border: 1px solid rgba(20, 18, 14, 0.1);
  background: #fff;
}

.status.working { border-color: rgba(20, 18, 14, 0.18); }
.status.ok { border-color: rgba(34, 120, 60, 0.3); background: #effaf1; color: #1f5a32; }
.status.error { border-color: rgba(217, 65, 46, 0.45); background: #fff0ec; color: #861f12; }

.hidden { display: none !important; }

.progress {
  margin-top: 18px;
  padding: 18px;
  background: var(--paper);
  border: 1px solid rgba(20, 18, 14, 0.08);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.progress-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--ink-2);
}

.progress-stage {
  letter-spacing: 0.02em;
}

.progress-pct {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.progress-track {
  position: relative;
  height: 8px;
  background: var(--bg-2);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #f08a3a);
  border-radius: 999px;
  transition: width 420ms var(--ease);
  position: relative;
}

.progress-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.4) 50%,
    transparent 100%
  );
  animation: progressShine 1600ms linear infinite;
}

@keyframes progressShine {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}

.result {
  margin-top: 22px;
  padding: 24px;
  background: var(--paper);
  border: 1px solid rgba(20, 18, 14, 0.08);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.result-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.result-eyebrow {
  margin: 0 0 6px;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.result-title {
  margin: 0;
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 24px;
  letter-spacing: -0.02em;
}

.result-id {
  margin: 8px 0 0;
  color: var(--ink-2);
  font-size: 13px;
}

.result-id code {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--bg-2);
  padding: 2px 8px;
  border-radius: 6px;
}

.download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  padding: 14px 22px;
  border-radius: 12px;
  transition: transform 180ms var(--ease), background 180ms var(--ease);
}

.download:hover { background: var(--ink); transform: translateY(-1px); }

.how {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 60px;
}

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

.how-item {
  background: var(--paper);
  border: 1px solid rgba(20, 18, 14, 0.08);
  border-radius: var(--radius-lg);
  padding: 22px;
  position: relative;
  overflow: hidden;
}

.how-item .step {
  font-family: 'Fraunces', serif;
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--accent);
}

.how-item h3 {
  margin: 6px 0 8px;
  font-family: 'Fraunces', serif;
  font-weight: 500;
  letter-spacing: -0.01em;
  font-size: 22px;
}

.how-item p {
  margin: 0;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.55;
}

code {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92em;
}

.foot {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  padding: 22px clamp(20px, 5vw, 56px);
  border-top: 1px solid rgba(20, 18, 14, 0.08);
  font-size: 13px;
  color: var(--ink-2);
}

.foot .dim { opacity: 0.7; }

@media (max-width: 600px) {
  .field { flex-direction: column; }
  button#go { min-height: 52px; justify-content: center; }
}
