:root {
  color-scheme: dark;
  --bg: #090b0a;
  --surface: #101311;
  --surface-strong: #151916;
  --line: #252b27;
  --line-strong: #353d37;
  --text: #f2f5f3;
  --muted: #909b94;
  --accent: #39d98a;
  --accent-strong: #1fbf72;
  --danger: #ff766f;
  --radius: 14px;
  --font: "Segoe UI Variable", "Segoe UI", Arial, sans-serif;
  --mono: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 70% -20%, rgba(57, 217, 138, .08), transparent 32rem),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }

.app-shell {
  width: min(1160px, calc(100% - 40px));
  min-height: 100dvh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.topbar {
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.02em;
}

.brand-mark, .empty-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(57, 217, 138, .42);
  border-radius: 9px;
  background: rgba(57, 217, 138, .08);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 18px;
}

.quiet-button, .secondary-button, .download-button {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  padding: 9px 13px;
  transition: border-color .16s ease, color .16s ease, transform .16s ease;
}

.quiet-button:hover, .secondary-button:hover { border-color: var(--line-strong); color: var(--text); }
.quiet-button:active, .secondary-button:active, .primary-button:active, .download-button:active { transform: translateY(1px); }

.workspace { padding: 68px 0 48px; }

.composer {
  display: grid;
  grid-template-columns: minmax(260px, .76fr) minmax(420px, 1.24fr);
  gap: clamp(40px, 8vw, 110px);
  align-items: end;
  padding-bottom: 68px;
  border-bottom: 1px solid var(--line);
}

.composer-copy h1 {
  max-width: 560px;
  margin: 0 0 18px;
  font-size: clamp(42px, 5.2vw, 72px);
  line-height: .98;
  letter-spacing: -.072em;
}

.composer-copy p, .section-heading p, .empty-state p, .login-copy p {
  max-width: 48ch;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.download-form, .login-form { display: grid; gap: 11px; }

.download-form > label, .login-form > label, .mode-switch legend {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.url-row, .field-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }

input {
  width: 100%;
  min-width: 0;
  height: 52px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  outline: none;
  background: var(--surface);
  color: var(--text);
  padding: 0 16px;
  transition: border-color .16s ease, box-shadow .16s ease;
}

input::placeholder { color: #667069; }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(57, 217, 138, .12); }

.primary-button, .download-button {
  min-height: 44px;
  border: 1px solid var(--accent);
  border-radius: 11px;
  background: var(--accent);
  color: #062616;
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  padding: 0 20px;
  transition: background .16s ease, transform .16s ease;
  white-space: nowrap;
}

.primary-button:hover, .download-button:hover { background: var(--accent-strong); }
.primary-button:disabled { cursor: wait; opacity: .6; }

.form-footer {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

.mode-switch { display: flex; gap: 4px; margin: 0; padding: 0; border: 0; }
.mode-switch legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.mode-switch label { cursor: pointer; }
.mode-switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.mode-switch span {
  display: block;
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 680;
  padding: 7px 9px;
}
.mode-switch input:checked + span { background: var(--surface-strong); color: var(--text); }
.mode-switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.form-message { min-height: 1.4em; margin: 0; color: var(--danger); font-size: 12px; text-align: right; }

.queue-section { padding-top: 42px; }
.section-heading { display: flex; justify-content: space-between; gap: 32px; align-items: end; margin-bottom: 20px; }
.section-heading h2 { margin: 0 0 7px; font-size: 19px; letter-spacing: -.035em; }
.queue-count { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.queue { border-top: 1px solid var(--line); }

.job {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) minmax(150px, .45fr) auto;
  gap: 16px;
  align-items: center;
  min-height: 94px;
  border-bottom: 1px solid var(--line);
}

.job-kind {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

.job h3 { overflow: hidden; margin: 0 0 7px; font-size: 14px; font-weight: 690; letter-spacing: -.015em; text-overflow: ellipsis; white-space: nowrap; }
.job-meta { display: flex; gap: 8px; color: var(--muted); font-size: 11px; }
.job-meta span + span::before { content: "·"; margin-right: 8px; color: #4d5650; }
.job-status { display: grid; gap: 8px; }
.status-line { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-family: var(--mono); font-size: 10px; }
.status-label { color: var(--text); }
.progress-track { height: 2px; overflow: hidden; background: var(--line); }
.progress-bar { height: 100%; width: var(--progress); background: var(--accent); transition: width .35s ease; }
.job-actions { display: flex; gap: 7px; justify-content: flex-end; }
.download-button { display: inline-flex; align-items: center; min-height: 36px; padding: 0 13px; border-radius: 9px; font-size: 12px; }
.job-error { color: var(--danger); }

.empty-state { display: grid; justify-items: start; gap: 8px; padding: 54px 0 58px; }
.empty-state h3 { margin: 6px 0 0; font-size: 14px; }

.footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  padding: 22px 0 28px;
  border-top: 1px solid var(--line);
  color: #657069;
  font-family: var(--mono);
  font-size: 10px;
}

.login-shell { min-height: 100dvh; display: grid; place-items: center; padding: 30px; }
.login-panel { width: min(560px, 100%); }
.login-copy { margin: 84px 0 34px; }
.login-copy h1 { margin: 0 0 14px; font-size: clamp(42px, 8vw, 66px); line-height: 1; letter-spacing: -.07em; }
.login-note { margin: 16px 0 0; color: #667069; font-size: 11px; }
.form-error { margin: 0; color: var(--danger); font-size: 12px; }

@media (max-width: 820px) {
  .app-shell { width: min(100% - 28px, 680px); }
  .workspace { padding-top: 42px; }
  .composer { grid-template-columns: 1fr; gap: 34px; padding-bottom: 44px; }
  .composer-copy h1 { font-size: clamp(42px, 12vw, 62px); }
  .job { grid-template-columns: 44px minmax(0, 1fr) auto; padding: 16px 0; }
  .job-status { grid-column: 2 / -1; }
}

@media (max-width: 560px) {
  .url-row, .field-row { grid-template-columns: 1fr; }
  .primary-button { min-height: 50px; }
  .form-footer, .section-heading { align-items: flex-start; flex-direction: column; }
  .form-message { text-align: left; }
  .queue-count { order: -1; }
  .job { grid-template-columns: 38px minmax(0, 1fr); gap: 12px; }
  .job-kind { width: 36px; height: 36px; }
  .job-actions { grid-column: 2; justify-content: flex-start; }
  .footer { justify-content: space-between; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .001ms !important; }
}

