:root {
  --bg: #14120F;
  --surface: #1B1814;
  --surface-2: #221E18;
  --line: #2E2923;
  --line-soft: #242019;
  --text: #EDE8DF;
  --muted: #8B847A;
  --faint: #615A51;
  --amber: #D9A441;
  --amber-dim: #A87C2A;
  --ok: #8FB996;
  --ok-bg: #222C24;
  --bad: #E0928B;
  --bad-bg: #2F2320;
  --mono: "IBM Plex Mono", "SF Mono", "JetBrains Mono", ui-monospace, monospace;
  --sans: "Space Grotesk", "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  --ui: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --radius: 8px;
  --shadow-hover: 0 2px 10px rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; }

html {
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--ui);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

::selection { background: rgba(217, 164, 65, 0.28); }

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--amber);
  color: #14120F;
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
  font-weight: 600;
  z-index: 100;
}
.skip:focus { left: 0; }

h1, h2, h3 {
  font-family: var(--sans);
  margin: 0;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-weight: 700;
  margin-bottom: 1.4rem;
}
h1 em {
  font-style: normal;
  color: var(--amber);
}

h2 {
  font-size: 1.5rem;
  letter-spacing: -0.01em;
  font-weight: 600;
}

p { margin: 0 0 1rem; }

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--line-soft);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.brand-mark { color: var(--amber); }
.brand-name {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}
.brand-tag {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.06em;
}

.topbar-meta {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--faint);
  letter-spacing: 0.03em;
}

/* ---------- hero ---------- */

.hero {
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(3rem, 8vw, 6.5rem) 1.5rem 2rem;
  position: relative;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(600px 300px at 20% 0%, rgba(217, 164, 65, 0.05), transparent 70%),
    radial-gradient(500px 260px at 90% 10%, rgba(217, 164, 65, 0.03), transparent 70%);
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 1.2rem;
}

.lede {
  max-width: 58ch;
  color: var(--muted);
  font-size: 1.05rem;
  text-wrap: pretty;
}

/* ---------- dropzone ---------- */

.dropzone {
  margin-top: 2.5rem;
  border: 1.5px dashed var(--line);
  border-radius: 12px;
  padding: 3rem 1.5rem;
  text-align: center;
  background: var(--surface);
  transition: border-color 160ms ease, background 160ms ease;
  position: relative;
}
.dropzone.drag {
  border-color: var(--amber);
  background: var(--surface-2);
}
.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.dz-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--amber);
  color: #14120F;
  border: none;
  border-radius: 6px;
  font-family: var(--ui);
  font-size: 1rem;
  font-weight: 600;
  padding: 0.85rem 1.5rem;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
}
.dz-btn:hover { background: #E4B458; }
.dz-btn:active { transform: scale(0.98); }

.dz-hint {
  margin: 0.9rem 0 0;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--faint);
  letter-spacing: 0.05em;
}

/* ---------- settings ---------- */

.settings {
  margin-top: 1.6rem;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1.5rem 2.5rem;
  padding: 0 0.25rem;
}

.field-label {
  display: block;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  margin-bottom: 0.45rem;
}
.hint { color: var(--faint); }

select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: var(--ui);
  font-size: 0.9rem;
  padding: 0.5rem 2.2rem 0.5rem 0.75rem;
  min-width: 280px;
  cursor: pointer;
}

.check {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.92rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  padding-bottom: 0.55rem;
}
.check input {
  width: 17px;
  height: 17px;
  accent-color: var(--amber);
  cursor: pointer;
}

/* ---------- queue ---------- */

.queue {
  max-width: 1080px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

.queue-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.queue-actions { display: flex; gap: 0.5rem; }

.btn {
  background: var(--amber);
  color: #14120F;
  border: none;
  border-radius: 6px;
  font-family: var(--ui);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.6rem 1.1rem;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
}
.btn:hover:not(:disabled) { background: #E4B458; }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}
.btn.ghost:hover:not(:disabled) { color: var(--text); border-color: var(--faint); }

.queue-summary {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 0.9rem;
}

.decoder-warning {
  display: block;
  padding: 0.6rem 0.75rem;
  border: 1px solid rgba(224, 146, 139, 0.35);
  border-radius: 6px;
  background: var(--bad-bg);
  color: var(--bad);
}

.progress {
  height: 3px;
  background: var(--line-soft);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 1.2rem;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--amber);
  border-radius: 999px;
  transition: width 300ms ease;
}

/* ---------- rows ---------- */

.rows {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.8rem 1.2rem;
  content-visibility: auto;
  contain-intrinsic-size: auto 120px;
}

.row-name {
  font-family: var(--ui);
  font-weight: 600;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
  margin-bottom: 0.15rem;
}
.row-sub {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.row-status { justify-self: end; }

.chip {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}
.chip-queued { background: var(--surface-2); color: var(--faint); border: 1px solid var(--line); }
.chip-working { background: rgba(217, 164, 65, 0.14); color: var(--amber); border: 1px solid rgba(217, 164, 65, 0.35); }
.chip-done { background: var(--ok-bg); color: var(--ok); border: 1px solid rgba(143, 185, 150, 0.35); }
.chip-error { background: var(--bad-bg); color: var(--bad); border: 1px solid rgba(224, 146, 139, 0.35); }

.row-error-msg {
  grid-column: 1 / -1;
  font-size: 0.82rem;
  color: var(--bad);
  margin: 0;
}

/* manifest */

.manifest {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line-soft);
  padding-top: 0.7rem;
  display: grid;
  gap: 0.2rem;
}
.m-line {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  font-variant-numeric: tabular-nums;
}
.m-k { width: 7.5ch; color: var(--faint); flex: none; }
.m-v { color: var(--text); }
.m-ok { color: var(--amber); font-weight: 500; }
.m-na { color: var(--faint); }
.m-strong { color: var(--ok); }

/* row actions */

.row-actions {
  display: flex;
  gap: 0.35rem;
  justify-self: end;
}
.icon-btn {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease;
}
.icon-btn:hover:not(:disabled) { color: var(--amber); border-color: var(--amber-dim); }
.icon-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.icon-btn.save { color: var(--amber); border-color: rgba(217, 164, 65, 0.4); }

.empty {
  text-align: center;
  color: var(--faint);
  padding: 3rem 1rem;
  border: 1px dashed var(--line-soft);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 0.8rem;
}
.empty svg { display: block; margin: 0 auto 0.8rem; opacity: 0.5; }

/* ---------- how ---------- */

.how {
  max-width: 1080px;
  margin: 0 auto;
  padding: 3rem 1.5rem 2rem;
  border-top: 1px solid var(--line-soft);
}

.how-head { margin-bottom: 1.5rem; }
.how-head h2 { margin-bottom: 0.4rem; }
.how-head p { color: var(--muted); max-width: 52ch; text-wrap: pretty; }

.bento {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.6rem 1.7rem;
  transition: box-shadow 200ms ease, transform 200ms ease;
}
.card:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.card h3 {
  font-size: 1.05rem;
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.card h3::before {
  content: "";
  width: 7px;
  height: 7px;
  background: var(--amber);
  border-radius: 2px;
  flex: none;
}
.card p { color: var(--muted); font-size: 0.93rem; margin-bottom: 0.9rem; text-wrap: pretty; }
.card-note {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--faint);
  margin: 0;
}
.code {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--muted);
  font-size: 0.7rem;
}

/* ---------- faq ---------- */

.faq {
  max-width: 1080px;
  margin: 0 auto;
  padding: 3rem 1.5rem 2rem;
  border-top: 1px solid var(--line-soft);
}
.faq > h2 { margin-bottom: 1rem; }

.faq-item { border-bottom: 1px solid var(--line-soft); }

.faq-q {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: none;
  border: none;
  color: var(--text);
  font-family: var(--ui);
  font-size: 1rem;
  font-weight: 600;
  padding: 1.05rem 0.25rem;
  cursor: pointer;
  text-align: left;
}
.faq-q:hover { color: var(--amber); }
.faq-icon { color: var(--faint); transition: transform 200ms ease; flex: none; }
.faq-item.open .faq-icon { transform: rotate(45deg); color: var(--amber); }

.faq-a {
  padding: 0 0.25rem 1.2rem;
  color: var(--muted);
  font-size: 0.93rem;
  max-width: 70ch;
}
.faq-a strong { color: var(--text); font-weight: 600; }

/* ---------- footer ---------- */

footer {
  border-top: 1px solid var(--line-soft);
  padding: 2.5rem 1.5rem 3.5rem;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--faint);
}
footer p { margin: 0.2rem 0; }
footer p:first-child { color: var(--muted); font-size: 0.8rem; }

/* ---------- motion ---------- */

.hero > * { animation: rise 600ms cubic-bezier(0.16, 1, 0.3, 1) both; }
.eyebrow { animation-delay: 40ms; }
.hero h1 { animation-delay: 90ms; }
.lede { animation-delay: 140ms; }
.dropzone { animation-delay: 190ms; }
.settings { animation-delay: 240ms; }

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
.chip-working { animation: pulse 1.2s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero > * { animation: none; }
  .chip-working { animation: none; }
  .card, .dz-btn, .btn, .icon-btn, .faq-icon { transition: none; }
}

/* ---------- responsive ---------- */

@media (max-width: 760px) {
  .bento { grid-template-columns: 1fr; }
  .topbar-meta { display: none; }
  .row { grid-template-columns: 1fr; }
  .row-status { justify-self: start; }
  .manifest { grid-column: 1; }
  select { min-width: 0; width: 100%; }
  .settings { flex-direction: column; align-items: stretch; gap: 1rem; }
}
