:root {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #202438;
  background: #f4f6fa;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 80% 0%, rgb(222 228 255 / 55%), transparent 38%),
    #f4f6fa;
}

.topbar {
  height: 72px;
  padding: 0 clamp(22px, 6vw, 88px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e7e9f0;
  background: rgb(255 255 255 / 82%);
}
.account-actions { display: flex; align-items: center; gap: 14px; }
.account-actions form { margin: 0; }
.logout-button { min-height: 34px; padding: 0 12px; gap: 0; background: transparent; color: #626981; font-size: 0.75rem; }
.logout-button:hover { background: #eef0fb; color: #4258c6; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: #22263a;
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
}

.brand-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #5267d8;
  color: #fff;
  font-size: 1rem;
}

.brand-muted { color: #74798d; font-weight: 500; }
.version-label, .step-label { color: #85899b; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.12em; }

.page-shell {
  width: min(100% - 40px, 760px);
  margin: 70px auto 42px;
}

.intro { margin: 0 0 30px 4px; }
.eyebrow { margin: 0 0 11px; color: #5267d8; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.14em; }

h1 {
  max-width: 600px;
  margin: 0;
  color: #202438;
  font-size: clamp(2.1rem, 6vw, 3.35rem);
  font-weight: 650;
  letter-spacing: -0.055em;
  line-height: 1.08;
}

.intro-copy { margin: 15px 0 0; color: #74798d; font-size: 1rem; }

.workspace {
  padding: clamp(24px, 5vw, 42px);
  border: 1px solid #e8eaf1;
  border-radius: 17px;
  background: #fff;
  box-shadow: 0 22px 65px rgb(35 42 75 / 7%);
}

.form-heading, .job-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.form-heading { margin-bottom: 30px; }
h2 { margin: 0; font-size: 1.22rem; letter-spacing: -0.025em; }
.form-heading p { margin: 7px 0 0; color: #85899b; font-size: 0.86rem; }
.step-label { padding-top: 6px; white-space: nowrap; }

.field-label { display: flex; align-items: baseline; gap: 10px; margin: 0 0 10px; color: #303449; font-size: 0.84rem; font-weight: 700; }
.field-hint { color: #969aab; font-size: 0.75rem; font-weight: 400; }

input[type="file"], select, textarea {
  width: 100%;
  border: 1px solid #e3e5ec;
  border-radius: 9px;
  background: #fff;
  color: #34384a;
  font: inherit;
}

input[type="file"] { min-height: 48px; padding: 9px 11px; color: #73788a; font-size: 0.8rem; }
input[type="file"]::file-selector-button { margin-right: 12px; padding: 8px 11px; border: 0; border-radius: 6px; background: #eef0fb; color: #4c5fc6; font: inherit; font-weight: 650; cursor: pointer; }
textarea { min-height: 92px; padding: 13px 14px; resize: vertical; line-height: 1.5; }
textarea::placeholder { color: #a3a6b3; }
select { height: 48px; padding: 0 12px; }
input[type="file"]:focus, select:focus, textarea:focus { outline: 3px solid rgb(82 103 216 / 16%); border-color: #8795e7; }

.image-previews { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.image-thumb { width: 56px; height: 66px; border: 1px solid #e3e5ec; border-radius: 7px; object-fit: cover; }
.prompt-label { margin-top: 24px; }
.helper-text { margin: 8px 0 0; color: #9296a6; font-size: 0.75rem; line-height: 1.45; }
.form-row { display: grid; grid-template-columns: 0.75fr 1.25fr; gap: 18px; margin-top: 23px; }
.form-field { min-width: 0; }
.submit-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 30px; padding-top: 23px; border-top: 1px solid #eff0f4; }
.privacy-note { margin: 0; color: #9094a3; font-size: 0.74rem; line-height: 1.45; }

button, .download-button {
  min-height: 46px;
  padding: 0 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  border: 0;
  border-radius: 8px;
  background: #5267d8;
  color: #fff;
  font: inherit;
  font-size: 0.83rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background 120ms ease, transform 120ms ease;
}

button:hover, .download-button:hover { transform: translateY(-1px); background: #4258c6; }
button:disabled { opacity: 0.62; cursor: wait; transform: none; }

.job-panel { margin-top: 24px; padding: 24px; border: 1px solid #e8eaf1; border-radius: 12px; background: #fafbfe; }
.job-panel[hidden] { display: none; }
.job-heading { align-items: center; }
.job-heading .eyebrow { margin-bottom: 7px; }
.status-badge { padding: 7px 10px; border-radius: 99px; background: #eef0fb; color: #5666bc; font-size: 0.72rem; font-weight: 700; }
.status-processing { background: #fff4dc; color: #9a690e; }
.status-completed { background: #e6f6ed; color: #27754a; }
.status-failed { background: #ffeded; color: #a33f3f; }
.job-message { margin: 13px 0 0; color: #74798d; font-size: 0.84rem; line-height: 1.5; }
.reel-preview { width: min(100%, 320px); max-height: 570px; margin-top: 20px; display: block; border-radius: 10px; background: #171923; }
.reel-preview[hidden], .download-button[hidden] { display: none; }
.download-button { margin-top: 16px; }

.recent-jobs { margin-top: 34px; padding-top: 27px; border-top: 1px solid #eff0f4; }
.recent-jobs .form-heading { margin-bottom: 17px; }
.recent-jobs-list { display: grid; gap: 10px; }
.recent-job { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 14px 15px; border: 1px solid #e8eaf1; border-radius: 9px; background: #fff; }
.recent-job-main { min-width: 0; }
.recent-job-title { margin: 0; color: #303449; font-size: 0.82rem; font-weight: 700; }
.recent-job-meta { margin: 6px 0 0; color: #85899b; font-size: 0.72rem; line-height: 1.5; overflow-wrap: anywhere; }
.recent-job-status { flex: 0 0 auto; padding: 6px 9px; border-radius: 99px; background: #eef0fb; color: #5666bc; font-size: 0.68rem; font-weight: 700; text-transform: capitalize; }
.recent-job-status.status-completed { background: #e6f6ed; color: #27754a; }
.recent-job-status.status-failed { background: #ffeded; color: #a33f3f; }
.recent-job-links { display: flex; gap: 10px; margin-top: 7px; font-size: 0.73rem; }
.recent-job-links a { color: #4c5fc6; font-weight: 650; text-decoration: none; }
.recent-job-links a:hover { text-decoration: underline; }
.login-shell { width: min(100% - 40px, 440px); margin: 12vh auto 42px; }
.login-card h1 { font-size: clamp(2rem, 6vw, 2.6rem); }
.login-form { display: grid; gap: 11px; margin-top: 26px; }
.login-input { width: 100%; height: 46px; margin-bottom: 9px; padding: 0 12px; border: 1px solid #e3e5ec; border-radius: 8px; font: inherit; }
.login-input:focus { outline: 3px solid rgb(82 103 216 / 16%); border-color: #8795e7; }
.login-form button { margin-top: 8px; }
.login-error { margin: 18px 0 0; padding: 11px 12px; border-radius: 7px; background: #ffeded; color: #a33f3f; font-size: 0.82rem; }

footer { margin: 22px 4px 0; color: #9296a6; font-size: 0.72rem; text-align: center; }

@media (max-width: 600px) {
  .topbar { height: 62px; padding: 0 18px; }
  .brand { font-size: 0.83rem; }
  .account-actions { gap: 6px; }
  .account-actions .version-label { max-width: 85px; overflow: hidden; text-overflow: ellipsis; }
  .page-shell { width: min(100% - 28px, 760px); margin-top: 42px; }
  .form-row { grid-template-columns: 1fr; gap: 19px; }
  .submit-row { align-items: stretch; flex-direction: column; }
  .submit-row button { width: 100%; }
  .workspace { padding: 23px 19px; }
  .recent-job { align-items: flex-start; padding: 12px; }
}
