:root {
  color-scheme: dark;
  --bg: #07111f;
  --surface: rgba(15, 28, 46, 0.86);
  --surface-strong: #12233a;
  --surface-soft: rgba(255, 255, 255, 0.045);
  --border: rgba(172, 196, 226, 0.16);
  --text: #f5f8fc;
  --muted: #9cafc6;
  --blue: #6da7ff;
  --blue-strong: #397fe9;
  --purple: #9b83ff;
  --green: #48d5a2;
  --red: #ff7082;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--bg); }

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 12% 0%, rgba(61, 126, 238, 0.14), transparent 34rem),
    radial-gradient(circle at 94% 22%, rgba(138, 99, 255, 0.12), transparent 30rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.ambient {
  position: fixed;
  z-index: -1;
  width: 20rem;
  height: 20rem;
  border-radius: 999px;
  filter: blur(90px);
  opacity: 0.12;
  pointer-events: none;
}
.ambient-one { top: 18%; left: -9rem; background: var(--blue); }
.ambient-two { right: -10rem; bottom: 5%; background: var(--purple); }

.topbar {
  width: min(1120px, calc(100% - 40px));
  min-height: 76px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 17px;
  background: linear-gradient(145deg, var(--blue), var(--purple));
  box-shadow: 0 14px 32px rgba(88, 121, 244, 0.3);
}
.brand-mark span {
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 11px solid white;
  transform: translateX(1px);
}
.brand-mark-small { width: 34px; height: 34px; border-radius: 11px; }
.brand-mark-small span { border-top-width: 5px; border-bottom-width: 5px; border-left-width: 8px; }

.page-shell { width: min(1040px, calc(100% - 40px)); margin: 0 auto; padding: 76px 0 50px; }

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 36px;
  margin-bottom: 42px;
}

.eyebrow, .section-kicker {
  margin: 0 0 13px;
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 780;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(72, 213, 162, 0.11);
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 16px; font-size: clamp(2.65rem, 7vw, 5.2rem); line-height: 0.98; letter-spacing: -0.062em; max-width: 760px; }
h2 { margin-bottom: 0; font-size: clamp(1.35rem, 3vw, 2rem); line-height: 1.15; letter-spacing: -0.035em; }
h3 { margin-bottom: 0; }

.hero-copy { max-width: 650px; margin-bottom: 0; color: var(--muted); font-size: 1.08rem; line-height: 1.7; }

.quality-badge {
  width: 132px;
  height: 132px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  border: 1px solid rgba(118, 165, 255, 0.35);
  border-radius: 32px;
  background: linear-gradient(145deg, rgba(76, 132, 229, 0.2), rgba(129, 92, 222, 0.11));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.quality-number { font-size: 2.15rem; font-weight: 820; line-height: 1; letter-spacing: -0.06em; }
.quality-unit { margin-top: 4px; color: var(--muted); font-size: 0.76rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }

.download-panel, .job-card, .login-card {
  border: 1px solid var(--border);
  background: linear-gradient(145deg, rgba(20, 38, 61, 0.94), rgba(12, 25, 42, 0.94));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.045);
  backdrop-filter: blur(20px);
}

.download-panel { padding: 30px; border-radius: 28px; }
.panel-heading, .section-header, .job-title-row, .job-actions, .progress-caption { display: flex; align-items: center; justify-content: space-between; gap: 16px; }

.format-pill, .status-chip, .storage-status {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 0.74rem;
  font-weight: 760;
  letter-spacing: 0.05em;
  white-space: nowrap;
}
.format-pill { padding: 8px 12px; color: #c7d9ff; }
.storage-status { padding: 8px 13px; }

.download-form { display: grid; grid-template-columns: 1fr auto; gap: 12px; margin-top: 25px; }
.url-field { position: relative; }
.url-icon { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--blue); font-weight: 800; }
input {
  width: 100%;
  min-height: 56px;
  padding: 0 18px 0 47px;
  border: 1px solid var(--border);
  border-radius: 16px;
  outline: none;
  background: rgba(5, 14, 26, 0.66);
  color: var(--text);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
input::placeholder { color: #6f8198; }
input:focus { border-color: rgba(109, 167, 255, 0.72); box-shadow: 0 0 0 4px rgba(109, 167, 255, 0.11); }

.button {
  min-height: 42px;
  padding: 0 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: 13px;
  cursor: pointer;
  text-decoration: none;
  font-weight: 760;
  transition: transform 150ms ease, opacity 150ms ease, background 150ms ease;
}
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button:disabled { cursor: wait; opacity: 0.55; }
.button-primary { background: linear-gradient(135deg, var(--blue-strong), #6d62ec); color: white; box-shadow: 0 10px 24px rgba(55, 112, 217, 0.25); }
.button-ghost { border: 1px solid var(--border); background: var(--surface-soft); color: #c5d2e4; }
.button-download { min-height: 56px; padding: 0 22px; }
.button-full { width: 100%; min-height: 52px; }
.button-small { min-height: 38px; padding: 0 14px; font-size: 0.82rem; }

.feature-row { display: flex; flex-wrap: wrap; gap: 10px 20px; margin-top: 18px; color: #7f93ab; font-size: 0.78rem; }
.form-error { margin: 14px 2px 0; color: #ff95a2; font-size: 0.87rem; }

.jobs-section { margin-top: 58px; }
.section-header { margin-bottom: 18px; }
.jobs-list { display: grid; gap: 12px; }

.empty-state { padding: 55px 22px; border: 1px dashed rgba(172, 196, 226, 0.2); border-radius: 24px; text-align: center; background: rgba(255, 255, 255, 0.018); }
.empty-state[hidden] { display: none; }
.empty-icon { width: 48px; height: 48px; margin: 0 auto 15px; display: grid; place-items: center; border-radius: 15px; background: rgba(109, 167, 255, 0.1); color: var(--blue); font-size: 1.35rem; }
.empty-state h3 { margin-bottom: 5px; }
.empty-state p { margin-bottom: 0; color: var(--muted); }

.job-card { padding: 20px; border-radius: 22px; }
.job-main { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; }
.job-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; background: rgba(109, 167, 255, 0.11); color: var(--blue); font-weight: 900; }
.job-icon-complete { background: rgba(72, 213, 162, 0.12); color: var(--green); }
.job-failed .job-icon { background: rgba(255, 112, 130, 0.11); color: var(--red); }
.job-copy { min-width: 0; }
.job-copy h3 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.98rem; }
.job-copy p { margin: 5px 0 0; color: var(--muted); font-size: 0.8rem; }
.status-chip { padding: 5px 9px; }
.status-completed { color: var(--green); border-color: rgba(72, 213, 162, 0.2); }
.status-failed { color: var(--red); border-color: rgba(255, 112, 130, 0.2); }
.status-downloading, .status-retrying, .status-processing { color: var(--blue); border-color: rgba(109, 167, 255, 0.2); }
.progress-track { height: 7px; margin-top: 18px; overflow: hidden; border-radius: 999px; background: rgba(255, 255, 255, 0.065); }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue-strong), var(--purple)); transition: width 350ms ease; }
.progress-caption { margin-top: 7px; color: #7589a2; font-size: 0.7rem; }
.job-actions { justify-content: flex-end; margin-top: 16px; }

.footer-note { margin-top: 34px; color: #63778f; text-align: center; font-size: 0.76rem; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 10; transform: translateX(-50%); padding: 12px 18px; border: 1px solid var(--border); border-radius: 13px; background: #14263e; box-shadow: var(--shadow); font-size: 0.86rem; }
.toast[hidden] { display: none; }

.login-page { display: grid; place-items: center; padding: 24px; }
.login-shell { width: 100%; max-width: 430px; }
.login-card { padding: 38px; border-radius: 28px; }
.login-card .brand-mark { margin-bottom: 26px; }
.login-card h1 { margin-bottom: 10px; font-size: 2.35rem; }
.muted { color: var(--muted); }
.login-form { display: grid; gap: 9px; margin-top: 28px; }
.login-form label { margin-top: 7px; color: #c5d2e4; font-size: 0.82rem; font-weight: 680; }
.login-form input { padding-left: 16px; }
.login-form .button { margin-top: 13px; }
.alert { margin: 20px 0 0; padding: 11px 13px; border-radius: 12px; font-size: 0.82rem; }
.alert-error { border: 1px solid rgba(255, 112, 130, 0.25); background: rgba(255, 112, 130, 0.08); color: #ffacb6; }
.alert-success { border: 1px solid rgba(72, 213, 162, 0.25); background: rgba(72, 213, 162, 0.08); color: #8fe9c9; }
.login-footnote { margin: 24px 0 0; color: #6f8299; text-align: center; font-size: 0.74rem; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 720px) {
  .topbar, .page-shell { width: min(100% - 28px, 1040px); }
  .topbar { min-height: 66px; }
  .brand { font-size: 0.9rem; }
  .page-shell { padding-top: 48px; }
  .hero { grid-template-columns: 1fr; align-items: start; gap: 22px; }
  .quality-badge { width: auto; height: auto; min-height: 78px; flex-direction: row; align-items: baseline; justify-content: flex-start; gap: 7px; border-radius: 21px; }
  .quality-number { font-size: 1.8rem; }
  .download-panel { padding: 21px; border-radius: 23px; }
  .download-form { grid-template-columns: 1fr; }
  .button-download { width: 100%; }
  .feature-row { display: grid; gap: 7px; }
  .jobs-section { margin-top: 44px; }
  .section-header { align-items: flex-end; }
  .job-title-row { align-items: flex-start; }
  .job-copy h3 { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .status-chip { flex: 0 0 auto; }
  .job-actions { display: grid; grid-template-columns: 1fr; }
  .job-actions .button { width: 100%; }
  .login-card { padding: 28px 22px; }
}

@media (max-width: 430px) {
  h1 { font-size: 2.7rem; }
  .topbar .button { min-height: 38px; padding: 0 12px; font-size: 0.78rem; }
  .download-panel .panel-heading { align-items: flex-start; }
  .job-card { padding: 17px; }
  .job-main { grid-template-columns: 1fr; }
  .job-icon { display: none; }
  .storage-status { font-size: 0.68rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

