:root {
  color-scheme: dark light;
  --bg: #151817;
  --surface: #1c201f;
  --surface-2: #242927;
  --line: #393f3d;
  --text: #f2f3ef;
  --muted: #a9b0ac;
  --accent: #f0785d;
  --accent-hover: #fb896e;
  --accent-ink: #2a100b;
  --danger: #ff9a86;
  --input: #171b1a;
  --input-border: #4b524f;
  --focus: rgba(240, 120, 93, .18);
  --shadow: rgba(5, 10, 8, .24);
  --pattern: #4a514e;
  --check-border: #59615e;
  --placeholder: #767e7a;
  --track: #343a38;
  --radius: 14px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #eef0ec;
    --surface: #f8f9f5;
    --surface-2: #e3e6e1;
    --line: #cbd0ca;
    --text: #222725;
    --muted: #626a66;
    --accent: #d95f45;
    --accent-hover: #c95138;
    --accent-ink: #fff8f5;
    --danger: #aa3f2c;
    --input: #f0f2ee;
    --input-border: #aeb5b0;
    --focus: rgba(217, 95, 69, .2);
    --shadow: rgba(45, 56, 50, .12);
    --pattern: #aeb4b0;
    --check-border: #8c9590;
    --placeholder: #6d7571;
    --track: #d2d6d1;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: "Avenir Next", Avenir, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
a { color: inherit; }

.noise {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E");
}

.site-header, main, footer {
  width: min(1180px, calc(100% - 48px));
  margin-inline: auto;
}

.site-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -.03em;
}

.brand-mark {
  width: 28px;
  height: 28px;
  padding: 5px;
  display: flex;
  align-items: end;
  gap: 2px;
  border: 1px solid var(--check-border);
  border-radius: 8px;
}

.brand-mark i { width: 3px; background: var(--accent); border-radius: 2px; }
.brand-mark i:nth-child(1) { height: 7px; }
.brand-mark i:nth-child(2) { height: 14px; }
.brand-mark i:nth-child(3) { height: 10px; }
.brand-mark i:nth-child(4) { height: 16px; }

.header-link {
  color: var(--muted);
  font-size: 14px;
  text-underline-offset: 5px;
  text-decoration-color: #5d6461;
  transition: color .2s ease;
}
.header-link:hover { color: var(--text); }

.hero {
  min-height: calc(100dvh - 72px);
  display: grid;
  grid-template-columns: minmax(0, .88fr) minmax(430px, 1.12fr);
  align-items: center;
  gap: clamp(48px, 8vw, 120px);
  padding: 64px 0 72px;
}

.hero-copy { align-self: center; }
.eyebrow {
  margin: 0 0 24px;
  color: var(--accent);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1 {
  margin-bottom: 24px;
  max-width: 570px;
  font-size: clamp(46px, 5.2vw, 78px);
  line-height: .98;
  letter-spacing: -.06em;
  font-weight: 600;
}

.intro {
  max-width: 390px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
}

.download-panel {
  position: relative;
  padding: clamp(24px, 3vw, 40px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 32px 80px var(--shadow);
}

.download-panel::before {
  content: "";
  position: absolute;
  top: 16px;
  right: 16px;
  width: 42px;
  height: 5px;
  border-radius: 5px;
  background: repeating-linear-gradient(90deg, var(--pattern) 0 3px, transparent 3px 7px);
}

.field { margin-bottom: 24px; }
label { display: block; margin-bottom: 9px; font-size: 14px; font-weight: 600; }
.source-field { margin-bottom: 18px; }
.source-row { display: grid; grid-template-columns: minmax(0, 1fr) 76px; gap: 10px; }
.input-shell {
  display: grid;
  grid-template-columns: 58px 1fr;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--input-border);
  border-radius: 10px;
  background: var(--input);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.input-shell:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus);
}
.input-prefix {
  padding-left: 17px;
  color: #7f8884;
  font: 700 10px/1 ui-monospace, "SFMono-Regular", Consolas, monospace;
  letter-spacing: .08em;
}
input {
  width: 100%;
  min-width: 0;
  padding: 15px 16px 15px 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}
input::placeholder { color: var(--placeholder); }
.field-help, .field-error { margin: 8px 0 0; font-size: 12px; line-height: 1.45; }
.field-help { color: #919995; }
.field-error { min-height: 0; color: var(--danger); }
.field-error:not(:empty) { min-height: 17px; }
.input-shell.invalid { border-color: var(--danger); }

.add-button {
  border: 1px solid var(--input-border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  transition: border-color .2s ease, transform .15s ease;
}
.add-button:hover { border-color: var(--accent); }
.add-button:active { transform: translateY(1px); }
.add-button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.pending { margin-bottom: 24px; }
.pending-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.pending-head h2 { margin: 0; font-size: 14px; letter-spacing: 0; }
.pending-head span { color: var(--muted); font-size: 12px; }
.pending-empty {
  padding: 16px;
  border: 1px dashed var(--input-border);
  border-radius: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.pending-list { margin: 0; padding: 0; list-style: none; }
.pending-item {
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.source-summary {
  padding: 12px 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  background: var(--input);
}
.pending-type { display: block; margin-bottom: 3px; color: var(--text); font-size: 12px; font-weight: 700; }
.pending-url { display: block; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.source-progress { display: block; margin-top: 5px; color: var(--accent); font-size: 10px; }
.remove-button {
  padding: 6px 0 6px 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.remove-button:hover { color: var(--text); }

.track-list {
  max-height: 300px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
}
.track-item {
  min-height: 50px;
  padding: 8px 12px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--line);
}
.track-art {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 9px;
}
.track-art img { width: 100%; height: 100%; object-fit: cover; }
.track-copy { min-width: 0; }
.track-copy strong, .track-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track-copy strong { font-size: 11px; }
.track-copy span { margin-top: 2px; color: var(--muted); font-size: 9px; }
.track-state { color: var(--muted); font-size: 9px; white-space: nowrap; }
.track-state.ready { color: var(--accent); }
.track-state.blocked { color: var(--danger); }
.track-skeleton { animation: soft-pulse 1.2s ease-in-out infinite alternate; }

.verification-block {
  margin: 14px 0;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--input-border);
  border-radius: 10px;
  background: var(--surface-2);
}
.verification-block h3 { margin-bottom: 4px; color: var(--text); font-size: 13px; }
.verification-block p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.verification-block button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--input-border);
  border-radius: 8px;
  background: var(--input);
  color: var(--text);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}
.verification-block button:hover { border-color: var(--accent); }

.issues {
  margin: 14px 0;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--danger) 52%, var(--line));
  border-radius: 10px;
  background: color-mix(in srgb, var(--danger) 6%, var(--surface));
}
.issues-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.issues-head h3 { margin-bottom: 4px; color: var(--danger); font-size: 13px; }
.issues-head p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.issues-head > span { color: var(--danger); font-size: 10px; white-space: nowrap; }
.issues-list {
  max-height: 320px;
  padding-right: 4px;
  display: grid;
  gap: 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.issue-card { padding: 12px; border-radius: 8px; background: var(--input); }
.issue-card h4 { margin: 0 0 3px; font-size: 11px; }
.issue-meta, .issue-reason { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.45; }
.issue-reason { margin-top: 6px; color: var(--danger); }
.replacement-field { margin-top: 10px; }
.replacement-field label { margin-bottom: 5px; font-size: 10px; }
.replacement-input { padding: 10px 11px; border: 1px solid var(--input-border); border-radius: 7px; background: var(--surface); font-size: 10px; }
.issue-actions { display: flex; gap: 8px; margin-top: 9px; }
.issue-actions button { min-height: 34px; padding: 0 11px; border-radius: 7px; font-size: 10px; font-weight: 700; cursor: pointer; }
.replace-button { border: 0; background: var(--accent); color: var(--accent-ink); }
.skip-button { border: 1px solid var(--input-border); background: transparent; color: var(--text); }
.issue-decision { margin-top: 9px; color: var(--accent); font-size: 10px; font-weight: 700; }

.download-resolution {
  margin-top: 24px;
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--danger) 52%, var(--line));
  border-radius: 10px;
  background: color-mix(in srgb, var(--danger) 6%, var(--surface));
}
.continue-button {
  width: 100%;
  min-height: 42px;
  margin-top: 12px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.continue-button:disabled { cursor: not-allowed; opacity: .5; }

.download-button {
  width: 100%;
  min-height: 54px;
  padding: 0 18px 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  cursor: pointer;
  transition: background .2s ease, transform .15s ease;
}
.download-button:hover { background: var(--accent-hover); }
.download-button:active { transform: translateY(1px); }
.download-button:focus-visible { outline: 3px solid #f5a08d; outline-offset: 3px; }
.download-button:disabled { cursor: wait; opacity: .62; }
.download-button:disabled { cursor: not-allowed; }
.button-arrow { font: 700 22px/1 ui-monospace, "SFMono-Regular", Consolas, monospace; }

.progress, .result, .request-error {
  margin-top: 24px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.progress-head { display: flex; justify-content: space-between; gap: 16px; font-size: 14px; font-weight: 600; }
.progress-time { color: var(--muted); font: 12px/1.5 ui-monospace, "SFMono-Regular", Consolas, monospace; }
.progress-track { height: 3px; margin: 14px 0; overflow: hidden; background: var(--track); }
.progress-track span { display: block; width: 38%; height: 100%; background: var(--accent); animation: travel 1.4s ease-in-out infinite alternate; }
.progress p, .result p, .request-error p { margin-bottom: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.result { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; }
.result-mark { color: var(--accent); font-size: 23px; }
.request-error strong { color: var(--danger); }
.archive-links { display: grid; gap: 8px; margin-top: 14px; }
.archive-link {
  min-height: 44px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--input-border);
  border-radius: 9px;
  background: var(--input);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}
.archive-link:hover { border-color: var(--accent); }
.archive-link small { color: var(--muted); font-weight: 500; white-space: nowrap; }

.history { margin-top: 24px; border-top: 1px solid var(--line); }
.history summary {
  padding-top: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.history summary::marker { color: var(--accent); }
.history summary span:last-child { color: var(--muted); font-size: 11px; font-weight: 500; }
.history-body { padding: 16px 0 2px; }
.history-empty { margin-bottom: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.history-list { margin: 0; padding: 0; list-style: none; }
.history-item { padding: 10px 0; border-bottom: 1px solid var(--line); }
.history-item:first-child { border-top: 1px solid var(--line); }
.history-item strong { display: block; overflow: hidden; margin-bottom: 3px; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.history-item span { color: var(--muted); font-size: 10px; }
.history-status { color: var(--accent) !important; font-weight: 700; text-transform: capitalize; }
.clear-history {
  margin-top: 14px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.clear-history:hover { color: var(--text); }

.how { padding: 118px 0 128px; border-top: 1px solid var(--line); }
.how-heading { max-width: 640px; margin-bottom: 64px; }
h2 { margin-bottom: 18px; font-size: clamp(36px, 5vw, 58px); line-height: 1; letter-spacing: -.05em; }
.how-heading p { max-width: 560px; color: var(--muted); line-height: 1.6; }
.steps { display: grid; grid-template-columns: 1.15fr .95fr .9fr; gap: 0; }
.steps article { min-height: 210px; padding: 28px; border-left: 1px solid var(--line); }
.steps article:last-child { border-right: 1px solid var(--line); }
.step-glyph { display: block; min-height: 48px; color: var(--accent); font: 25px/1 ui-monospace, "SFMono-Regular", Consolas, monospace; }
h3 { margin-bottom: 12px; font-size: 20px; letter-spacing: -.025em; }
.steps p { max-width: 260px; margin-bottom: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }

footer {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}
footer span { color: var(--text); font-weight: 700; }
footer p { margin: 0; text-align: right; }

[hidden] { display: none !important; }
@keyframes travel { from { transform: translateX(-10%); } to { transform: translateX(175%); } }
@keyframes soft-pulse { from { opacity: .45; } to { opacity: 1; } }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 46px; padding: 64px 0 80px; }
  .hero-copy { max-width: 670px; }
  h1 { max-width: 680px; }
  .download-panel { max-width: 650px; width: 100%; }
}

@media (max-width: 640px) {
  .site-header, main, footer { width: min(100% - 32px, 1180px); }
  .site-header { min-height: 64px; }
  .hero { min-height: auto; padding: 48px 0 72px; }
  .eyebrow { margin-bottom: 18px; }
  h1 { font-size: clamp(42px, 14vw, 60px); }
  .intro { font-size: 16px; }
  .download-panel { padding: 22px 18px; }
  .source-row { grid-template-columns: 1fr; }
  .add-button { min-height: 44px; }
  .verification-block { align-items: stretch; flex-direction: column; }
  .how { padding: 80px 0; }
  .how-heading { margin-bottom: 44px; }
  .steps { grid-template-columns: 1fr; }
  .steps article { min-height: auto; padding: 28px 20px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .steps article:first-child { border-top: 1px solid var(--line); }
  .step-glyph { min-height: 40px; }
  footer { min-height: 120px; align-items: flex-start; flex-direction: column; justify-content: center; }
  footer p { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
