:root {
  color-scheme: light;
  --bg: #eaf6ff;
  --panel: #ffffff;
  --ink: #14243a;
  --muted: #60748c;
  --line: #c8def3;
  --line-strong: #a8cdea;
  --blue: #2387e6;
  --blue-deep: #116bbd;
  --blue-soft: #e6f3ff;
  --blue-tint: #f5fbff;
  --blue-band: #dcefff;
  --green: #0f8f64;
  --red: #d92d20;
  --amber: #b54708;
  --shadow: 0 18px 46px rgba(35, 135, 230, 0.12);
  --soft-shadow: 0 8px 20px rgba(35, 135, 230, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #f8fcff 0%, var(--bg) 52%, #fafdff 100%);
  color: var(--ink);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

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

.shell {
  min-height: 100vh;
}

.auth-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.82), rgba(232, 245, 255, 0.92)),
    repeating-linear-gradient(90deg, rgba(35, 135, 230, 0.06) 0 1px, transparent 1px 76px),
    repeating-linear-gradient(0deg, rgba(35, 135, 230, 0.05) 0 1px, transparent 1px 76px);
}

.auth-shell {
  width: min(980px, 100%);
  min-height: 560px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 420px);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.auth-visual {
  position: relative;
  min-width: 0;
  padding: 34px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    linear-gradient(135deg, #ffffff 0%, #f1f9ff 48%, #dcefff 100%);
  border-right: 1px solid var(--line);
}

.auth-mark {
  width: 68px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--blue-deep), #54b3fb);
  color: #fff;
  font-weight: 900;
  font-size: 18px;
  box-shadow: 0 12px 28px rgba(35, 135, 230, 0.24);
}

.auth-copy {
  max-width: 480px;
}

.auth-copy span,
.auth-head {
  margin-bottom: 20px;
}

.auth-copy span,
.auth-head span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.auth-copy h1 {
  margin: 10px 0 0;
  max-width: 12em;
  font-size: 42px;
  line-height: 1.12;
}

.auth-copy p {
  max-width: 26em;
  margin: 14px 0 0;
  color: #49657f;
  line-height: 1.7;
}

.auth-preview {
  width: min(420px, 100%);
  padding: 14px;
  border: 1px solid rgba(168, 205, 234, 0.7);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--soft-shadow);
}

.preview-line {
  height: 12px;
  width: 62%;
  border-radius: 999px;
  background: #d7ebfb;
  margin-bottom: 10px;
}

.preview-line.wide {
  width: 82%;
  background: #bfdff7;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.preview-grid span {
  aspect-ratio: 1;
  border-radius: 6px;
  background: linear-gradient(180deg, #f7fcff, #dcefff);
  border: 1px solid #cbe2f5;
}

.auth-card {
  min-width: 0;
  padding: 36px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #ffffff;
}

.auth-head h2 {
  margin: 4px 0 0;
  font-size: 30px;
  line-height: 1.2;
}

.auth-fields {
  display: grid;
  gap: 13px;
}

.auth-fields label {
  display: grid;
  gap: 7px;
}

.auth-fields label span {
  color: var(--muted);
  font-size: 13px;
}

.auth-fields input {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: #fbfdff;
  color: var(--ink);
}

.auth-fields input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.12);
}

.auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.remember-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 11px;
  color: var(--muted);
  font-size: 13px;
}

.remember-row input {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.token-box {
  display: grid;
  gap: 8px;
}

.token-box textarea {
  width: 100%;
  min-height: 186px;
  max-height: 320px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  font-family: Consolas, monospace;
  resize: vertical;
  background: #fbfdff;
  line-height: 1.55;
}

.login-box input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: #fbfdff;
  color: var(--ink);
}

.token-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.token-box textarea:focus,
.login-box input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.12);
}

.redeem-box {
  display: grid;
  grid-template-columns: 1fr 96px;
  gap: 8px;
  margin-top: 12px;
}

.redeem-box input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: #fbfdff;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(360px, 390px) minmax(420px, 460px) minmax(420px, 1fr);
  gap: 14px;
  padding: 14px;
  align-items: start;
  min-width: 0;
}

.account-panel,
.controls,
.stage {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.account-panel,
.controls {
  padding: 15px;
  position: sticky;
  top: 14px;
}

.account-panel {
  min-height: calc(100vh - 28px);
  display: flex;
  flex-direction: column;
}

.panel-title {
  margin: -15px -15px 14px;
  padding: 15px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #f1f8ff);
  border-radius: 8px 8px 0 0;
  position: relative;
}

.panel-title span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.panel-title h2 {
  margin: 2px 0 0;
  font-size: 20px;
  line-height: 1.2;
}

#logoutBtn {
  position: absolute;
  top: 14px;
  right: 14px;
  height: 34px;
  padding: 0 11px;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin-bottom: 12px;
}

.account-stats {
  grid-template-columns: 1fr;
  margin-top: 14px;
  gap: 9px;
}

.status-strip div,
.cost-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: linear-gradient(180deg, #ffffff 0%, var(--blue-tint) 100%);
  box-shadow: var(--soft-shadow);
}

.status-strip span,
.cost-box span,
label > span,
.stage-head span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.status-strip strong,
.cost-box strong {
  display: block;
  min-height: 24px;
  font-size: 19px;
  color: #10243d;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 13px;
  background: #fff;
  box-shadow: var(--soft-shadow);
}

.tab {
  height: 42px;
  background: #fff;
  color: var(--muted);
  font-weight: 700;
}

.tab.active {
  background: linear-gradient(135deg, var(--blue-deep), #48aaf6);
  color: #fff;
}

.form {
  display: grid;
  gap: 10px;
}

label {
  display: grid;
  gap: 6px;
}

select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  color: var(--ink);
  outline: none;
}

select {
  height: 40px;
  padding: 0 12px;
}

textarea {
  min-height: 118px;
  max-height: 260px;
  padding: 11px 12px;
  resize: vertical;
  line-height: 1.55;
}

.prompt-counter {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.prompt-counter.over-limit {
  color: var(--red);
  font-weight: 700;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.upload-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: linear-gradient(180deg, #f7fcff, #eef8ff);
  box-shadow: var(--soft-shadow);
}

.upload-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.upload-head span {
  color: var(--muted);
  font-size: 12px;
}

.drop {
  height: 82px;
  display: grid;
  place-items: center;
  gap: 4px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  position: relative;
}

.drop input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.drop span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 22px;
  margin: 0;
}

.drop b {
  font-weight: 600;
}

.thumbs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.thumb {
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  background: var(--blue-band);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  cursor: zoom-in;
}

.thumb button {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  color: #fff;
  background: rgba(23, 32, 42, 0.75);
}

.thumb.processing img {
  filter: saturate(0.7) brightness(0.88);
}

.thumb-status {
  position: absolute;
  left: 5px;
  bottom: 5px;
  max-width: calc(100% - 10px);
  padding: 3px 6px;
  border-radius: 999px;
  background: rgba(20, 36, 58, 0.76);
  color: #fff;
  font-size: 11px;
  line-height: 1.2;
  pointer-events: none;
}

.face-panel {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: #f7fcff;
}

.face-panel.enabled {
  border-color: #8ec6f3;
  background: linear-gradient(180deg, #ffffff, #eaf6ff);
}

.face-toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
}

.face-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
}

.face-level {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.face-level span {
  display: flex;
  justify-content: space-between;
}

.face-level input {
  width: 100%;
  accent-color: var(--blue);
}

#faceBlockStatus {
  color: var(--muted);
  line-height: 1.4;
}

.submit-panel {
  display: grid;
  gap: 9px;
}

.cost-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-color: #9dccf2;
  background: linear-gradient(135deg, #f7fcff, #e7f4ff);
}

.cost-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.cost-box small {
  grid-column: 1 / -1;
  color: var(--muted);
}

.pricing-box,
.announcement-box {
  display: grid;
  gap: 9px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: #f7fcff;
  box-shadow: var(--soft-shadow);
}

.pricing-box {
  flex: 1;
  align-content: start;
}

.pricing-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.pricing-head strong {
  color: var(--ink);
}

.pricing-head span,
.pricing-box small,
.announcement-box small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.announcement-content {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: #253041;
  line-height: 1.55;
  white-space: pre-wrap;
  font-size: 12px;
}

.pricing-list {
  display: grid;
  gap: 6px;
}

.pricing-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: #253041;
  font-size: 12px;
}

.pricing-row b {
  color: var(--blue);
  white-space: nowrap;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 10px;
}

.primary,
.secondary,
#loginBtn,
.icon {
  height: 40px;
  padding: 0 14px;
  border-radius: 8px;
}

.primary,
#loginBtn {
  background: linear-gradient(135deg, var(--blue-deep), #46a9f6);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(35, 135, 230, 0.22);
}

.secondary,
.icon {
  background: linear-gradient(180deg, #ffffff, #eaf5ff);
  color: #253041;
  border: 1px solid var(--line);
}

.stage {
  min-height: calc(100vh - 32px);
  padding: 18px;
}

.stage-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: -18px -18px 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #f3f9ff);
  border-radius: 8px 8px 0 0;
}

.stage-head h1 {
  margin: 0;
  font-size: 24px;
}

.tasks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.task {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  box-shadow: var(--soft-shadow);
}

.task:nth-child(even) {
  background: var(--blue-tint);
}

.task-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.task h3 {
  margin: 0;
  font-size: 15px;
  max-width: 70ch;
  overflow-wrap: anywhere;
  display: flex;
  align-items: center;
  gap: 8px;
}

.task-index {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.badge {
  white-space: nowrap;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  background: #edf6ff;
  color: var(--muted);
}

.badge.finished {
  color: var(--green);
  background: #eaf7f1;
}

.badge.failed {
  color: var(--red);
  background: #fff0ee;
}

.badge.generating,
.badge.queued,
.badge.uploading,
.badge.submitting {
  color: var(--amber);
  background: #fff5e8;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: var(--muted);
  font-size: 12px;
  margin: 8px 0 10px;
}

.prompt {
  max-height: 82px;
  overflow: auto;
  color: #344054;
  background: #ffffff;
  border-radius: 6px;
  padding: 8px;
  white-space: pre-wrap;
  font-size: 13px;
}

.task-detail {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.82);
}

.task-detail summary {
  cursor: pointer;
  padding: 8px 10px;
  color: #253041;
  font-size: 13px;
  font-weight: 700;
}

.task-detail dl {
  margin: 0;
  padding: 0 10px 10px;
}

.task-detail dt {
  color: var(--muted);
  font-size: 12px;
  margin-top: 8px;
}

.task-detail dd {
  margin: 4px 0 0;
  color: #253041;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.materials {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.material {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
}

.material:nth-child(even) {
  background: var(--blue-tint);
}

.material video,
.material img {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #111827;
  object-fit: contain;
  display: block;
}

.material-open,
.material-placeholder {
  width: 100%;
  min-height: 150px;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  padding: 14px;
  background: linear-gradient(180deg, #f8fcff, #e6f3ff);
  color: #253041;
  text-align: center;
}

.material-open strong,
.material-placeholder strong {
  font-size: 15px;
}

.material-open span,
.material-placeholder span {
  color: var(--muted);
  font-size: 12px;
}

.material-actions {
  display: flex;
  gap: 8px;
  padding: 8px;
}

.material-actions a,
.material-actions button {
  flex: 1;
  height: 34px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  text-decoration: none;
  background: linear-gradient(180deg, #ffffff, #eaf5ff);
  color: #253041;
  border: 1px solid var(--line);
}

.empty {
  display: grid;
  place-items: center;
  min-height: 360px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.empty strong,
.empty span {
  display: block;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  max-width: min(520px, calc(100vw - 32px));
  padding: 11px 14px;
  border-radius: 8px;
  background: #17202a;
  color: #fff;
  z-index: 20;
  box-shadow: 0 12px 40px rgba(23, 32, 42, 0.18);
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(19, 36, 59, 0.32);
  z-index: 30;
}

.modal-card {
  width: min(560px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 22px 60px rgba(19, 36, 59, 0.2);
}

.image-preview-card {
  width: min(920px, 100%);
  max-height: calc(100vh - 36px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 22px 60px rgba(19, 36, 59, 0.2);
}

.image-preview-card img {
  width: 100%;
  max-height: calc(100vh - 96px);
  object-fit: contain;
  background: #0f172a;
  display: block;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #f3faff);
  border-radius: 8px 8px 0 0;
}

.modal-head span {
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
}

.modal-head button {
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #eaf5ff);
  color: #253041;
}

.modal-body {
  max-height: min(60vh, 520px);
  overflow: auto;
  padding: 16px;
  color: #253041;
  line-height: 1.65;
  white-space: pre-wrap;
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .auth-view {
    padding: 16px;
    align-items: start;
  }

  .auth-shell {
    min-height: auto;
    grid-template-columns: 1fr;
  }

  .auth-visual {
    padding: 24px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .auth-copy h1 {
    max-width: none;
    font-size: 30px;
  }

  .auth-copy p {
    margin-top: 10px;
  }

  .auth-preview {
    display: none;
  }

  .auth-card {
    padding: 24px;
  }

  .workspace {
    padding-left: 12px;
    padding-right: 12px;
  }

  .token-box {
    width: 100%;
  }

  .token-box textarea {
    width: 100%;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .account-panel,
  .controls {
    position: static;
    min-height: 0;
  }
}

@media (max-width: 540px) {
  body {
    background: #f6fbff;
  }

  .auth-view {
    padding: 10px;
  }

  .auth-shell {
    width: 100%;
    border-radius: 8px;
  }

  .auth-visual {
    padding: 18px;
  }

  .auth-mark {
    width: 60px;
    height: 44px;
    font-size: 16px;
  }

  .auth-copy h1 {
    font-size: 24px;
  }

  .auth-copy p {
    font-size: 13px;
  }

  .auth-card {
    padding: 18px;
  }

  .auth-head h2 {
    font-size: 24px;
  }

  .auth-actions {
    grid-template-columns: 1fr;
  }

  .auth-fields input,
  .primary,
  .secondary,
  #loginBtn {
    min-height: 44px;
  }

  .workspace {
    padding: 10px;
    gap: 10px;
  }

  .account-panel,
  .controls,
  .stage {
    border-radius: 8px;
  }

  #logoutBtn {
    position: static;
    margin-top: 10px;
    width: 100%;
  }

  .redeem-box {
    grid-template-columns: 1fr;
  }

  .grid-3,
  .status-strip {
    grid-template-columns: 1fr;
  }

  .thumbs {
    grid-template-columns: repeat(3, 1fr);
  }

  .tasks,
  .materials {
    grid-template-columns: 1fr;
  }

  .task-head,
  .stage-head,
  .cost-box {
    align-items: stretch;
    flex-direction: column;
  }

  .cost-box {
    grid-template-columns: 1fr;
  }
}
