:root {
  color-scheme: light;
  --bg: #e9edf2;
  --ink: #071224;
  --muted: #64748b;
  --line: rgba(15, 23, 42, 0.12);
  --line-strong: rgba(15, 23, 42, 0.22);
  --panel: rgba(255, 255, 255, 0.82);
  --teal: #0f766e;
  --blue: #2563eb;
  --violet: #6155f5;
  --green: #147a45;
  --amber: #9a5a05;
  --red: #b42318;
  --shadow: 0 24px 70px rgba(15, 23, 42, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.72), rgba(233,237,242,0.96) 460px),
    linear-gradient(120deg, rgba(15,118,110,0.12), rgba(37,99,235,0.08) 42%, rgba(97,85,245,0.08)),
    var(--bg);
  color: var(--ink);
  font-family: Arial, "Microsoft YaHei", sans-serif;
  font-size: 14px;
}

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

a {
  color: inherit;
  text-decoration: none;
}

button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 16px;
  background: linear-gradient(135deg, var(--teal), var(--blue));
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.18);
}

button:disabled {
  opacity: 0.65;
  cursor: wait;
}

button.ghost {
  background: rgba(255,255,255,0.78);
  color: var(--ink);
  border-color: var(--line);
  box-shadow: none;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: rgba(255,255,255,0.92);
  color: var(--ink);
  outline: none;
}

input,
select {
  min-height: 42px;
  padding: 8px 10px;
}

textarea {
  min-height: 132px;
  padding: 12px;
  resize: vertical;
  line-height: 1.7;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(15,118,110,0.82);
  box-shadow: 0 0 0 4px rgba(15,118,110,0.12);
}

label {
  display: grid;
  gap: 8px;
  color: #22314a;
  font-weight: 800;
}

.page {
  width: min(1320px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 26px 0 58px;
}

.topbar,
.hero,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.topbar {
  min-height: 78px;
  margin-bottom: 18px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 24px;
  line-height: 1.2;
}

.brand small {
  margin-top: 4px;
  color: var(--muted);
}

.mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: #071224;
  color: #8df5df;
  font-weight: 900;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.nav a,
.nav span {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  background: rgba(255,255,255,0.74);
  color: #334155;
  font-weight: 700;
}

.hero {
  margin-bottom: 18px;
  padding: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  gap: 22px;
  align-items: center;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: 34px;
  line-height: 1.18;
}

.hero p {
  margin: 0;
  color: #405066;
  line-height: 1.75;
  font-size: 16px;
}

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

.summary div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(248,250,252,0.78);
}

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

.summary strong {
  font-size: 18px;
}

.summary span {
  margin-top: 4px;
  color: var(--muted);
}

.layout {
  display: grid;
  grid-template-columns: 350px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.layout.has-user {
  grid-template-columns: minmax(0, 1fr);
}

.layout.has-user .workspace {
  grid-column: 1 / -1;
}

.panel {
  overflow: hidden;
}

.panel-head {
  min-height: 58px;
  border-bottom: 1px solid var(--line);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255,255,255,0.58);
}

.panel-head h2 {
  margin: 0;
  font-size: 18px;
}

.panel-head span {
  color: var(--muted);
}

.panel-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.panel-tools span {
  font-size: 13px;
}

.panel-body {
  padding: 18px;
}

.stack {
  display: grid;
  gap: 14px;
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tabs {
  display: inline-flex;
  gap: 8px;
}

.tab-btn {
  min-height: 36px;
  background: rgba(255,255,255,0.82);
  color: var(--ink);
  border-color: var(--line);
  box-shadow: none;
}

.tab-btn.active {
  color: #fff;
  background: linear-gradient(135deg, var(--teal), var(--blue));
  border-color: transparent;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(310px, 0.8fr) minmax(340px, 1.2fr);
  gap: 18px;
  align-items: start;
}

.drop-zone {
  position: relative;
}

.drop-zone input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-card {
  min-height: 88px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255,255,255,0.88);
  cursor: pointer;
}

.upload-card > span:last-child {
  min-width: 0;
}

.upload-icon {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: #071224;
  color: #8df5df;
  font-weight: 900;
}

.upload-card strong,
.upload-card small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-card small {
  color: var(--muted);
  font-weight: 500;
}

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

.thumb {
  position: relative;
  height: 138px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #101b2c;
  color: #cbd5e1;
  text-align: center;
  line-height: 1.5;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.thumb-remove {
  position: absolute;
  right: 8px;
  top: 8px;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  background: rgba(7, 18, 36, 0.78);
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: none;
  font-size: 12px;
}

.form-panel {
  display: grid;
  gap: 14px;
}

.notice {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(248,250,252,0.86);
  color: var(--muted);
  line-height: 1.6;
  white-space: pre-wrap;
}

.notice.ok {
  border-color: rgba(20,122,69,0.26);
  background: #e8f6ef;
  color: var(--green);
}

.notice.warn {
  border-color: rgba(154,90,5,0.26);
  background: #fff4dc;
  color: var(--amber);
}

.notice.error {
  border-color: rgba(180,35,24,0.26);
  background: #fff0ee;
  color: var(--red);
}

.result-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 18px;
  align-items: start;
}

.result-stage {
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  place-items: center;
  background: #071224;
  color: #cbd5e1;
  overflow: hidden;
}

.result-image-button {
  width: 100%;
  max-height: 620px;
  min-height: 0;
  border: 0;
  border-radius: 6px;
  padding: 0;
  background: transparent;
  box-shadow: none;
  cursor: zoom-in;
}

.result-stage img,
.result-stage video {
  width: 100%;
  max-height: 620px;
  object-fit: contain;
  border-radius: 6px;
  display: block;
}

.stage-tip {
  margin-top: 10px;
  color: #94a3b8;
  font-size: 13px;
}

.task-list {
  display: grid;
  gap: 10px;
}

.task-list.refreshing {
  opacity: 0.68;
  filter: saturate(0.88);
}

.task-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 8px;
  background: rgba(255,255,255,0.68);
  color: var(--ink);
  box-shadow: none;
  text-align: left;
  cursor: pointer;
  width: 100%;
  min-height: 0;
}

.task-item:hover {
  border-color: rgba(37, 99, 235, 0.34);
  background: rgba(255,255,255,0.92);
}

.task-item.active {
  border-color: rgba(15, 118, 110, 0.52);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.10);
}

.task-item:disabled {
  cursor: default;
  opacity: 0.72;
}

.task-item:disabled:hover {
  border-color: var(--line);
  background: rgba(255,255,255,0.68);
}

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

.task-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #2563eb;
  font-size: 13px;
  font-weight: 800;
}

.status {
  border-radius: 999px;
  padding: 5px 9px;
  background: rgba(100,116,139,0.12);
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.status.success { background: #e8f6ef; color: var(--green); }
.status.failed { background: #fff0ee; color: var(--red); }
.status.pending,
.status.creating { background: #fff4dc; color: var(--amber); }

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

.hidden {
  display: none !important;
}

button.is-loading {
  position: relative;
  padding-left: 34px;
}

button.is-loading::before {
  content: "";
  position: absolute;
  left: 13px;
  width: 13px;
  height: 13px;
  border: 2px solid rgba(7, 18, 36, 0.22);
  border-top-color: var(--blue);
  border-radius: 999px;
  animation: spin 0.8s linear infinite;
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  padding: 28px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
  background: rgba(7, 18, 36, 0.82);
  backdrop-filter: blur(14px);
}

.image-modal-bar {
  width: min(1200px, 100%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #fff;
  font-weight: 800;
}

.image-modal-frame {
  width: min(1200px, 100%);
  min-height: 0;
  margin: 0 auto;
  display: grid;
  place-items: center;
}

.image-modal-frame img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
}

.image-modal-tip {
  width: min(1200px, 100%);
  margin: 0 auto;
  color: #cbd5e1;
  text-align: center;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 980px) {
  .page {
    width: min(100vw - 24px, 1320px);
  }

  .hero,
  .layout,
  .form-grid,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }

  .nav {
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  .brand strong {
    font-size: 21px;
  }

  .hero h1 {
    font-size: 28px;
  }

  .summary,
  .preview-grid {
    grid-template-columns: 1fr;
  }
}
