:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #667085;
  --line: #d8dee5;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --focus: rgba(15, 118, 110, 0.18);
  --warn: #b54708;
  --danger: #b42318;
  --surface-soft: #eef6f5;
  --shadow: 0 18px 42px rgba(17, 24, 39, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: 220px;
  background: linear-gradient(180deg, #e7f2f1 0%, rgba(231, 242, 241, 0) 100%);
  pointer-events: none;
  z-index: -1;
}

button,
input,
select {
  font: inherit;
}

button,
.download-link {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  padding: 0 18px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.18);
}

button:hover,
.download-link:hover {
  background: var(--accent-dark);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
}

.ghost:hover {
  background: var(--surface-soft);
}

.login-shell,
.app-shell {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.login-panel {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 30px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 32px 0 22px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.05;
}

h2 {
  font-size: 22px;
  line-height: 1.2;
}

.eyebrow {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.muted {
  color: var(--muted);
}

.workspace {
  display: grid;
  gap: 18px;
  padding-bottom: 42px;
}

.login-form,
.url-form,
.download-form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus);
}

.url-form,
.preview,
.job-panel,
.notice {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.url-form,
.job-panel,
.notice {
  padding: 20px;
}

.form-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.form-heading span {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--accent-dark);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.url-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.notice {
  color: var(--danger);
  font-weight: 700;
}

.preview {
  display: grid;
  grid-template-columns: minmax(260px, 38%) 1fr;
  overflow: hidden;
}

.thumb-wrap {
  min-height: 240px;
  background: #1f2937;
  aspect-ratio: 16 / 10;
}

.thumb-wrap img {
  width: 100%;
  height: 100%;
  min-height: 240px;
  object-fit: cover;
  display: block;
}

.preview-body {
  display: grid;
  align-content: center;
  gap: 14px;
  padding: 24px;
}

.download-form {
  grid-template-columns: 1fr auto;
  align-items: end;
  margin-top: 8px;
}

.job-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

#job-percent {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent-dark);
}

.progress-track {
  height: 12px;
  background: #e5eaf0;
  border-radius: 999px;
  overflow: hidden;
  margin: 18px 0 12px;
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: var(--accent);
  transition: width 180ms ease;
}

.download-link {
  margin-top: 16px;
  width: fit-content;
}

.form-error {
  color: var(--danger);
  font-weight: 700;
}

@media (max-width: 720px) {
  .topbar,
  .url-row,
  .download-form,
  .preview {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .topbar .ghost,
  .url-row button,
  .download-form button {
    width: 100%;
  }
}
