:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: #171a1f;
  background: #f3f5f6;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: #f3f5f6;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  min-height: 78px;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid #d9dee2;
  background: #ffffff;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  margin-top: 3px;
  font-size: 22px;
  line-height: 1.3;
}

h2 {
  font-size: 17px;
  line-height: 1.4;
}

h3 {
  font-size: 14px;
}

.eyebrow {
  color: #647079;
  font-size: 12px;
  line-height: 1.4;
}

.system-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #3f4a52;
  font-size: 13px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.state-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #a9b1b7;
}

.state-dot.ready {
  background: #16835b;
}

.state-dot.error {
  background: #c13b32;
}

.workspace {
  display: grid;
  grid-template-columns: 260px minmax(520px, 1fr) 330px;
  min-height: calc(100vh - 79px);
}

.identity-panel,
.production,
.queue-panel {
  min-width: 0;
}

.identity-panel {
  padding: 20px;
  border-right: 1px solid #d9dee2;
  background: #fafbfb;
}

.identity-frame {
  width: 100%;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border: 1px solid #cfd5d9;
  border-radius: 6px;
  background: #e8ebed;
}

.identity-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.identity-copy {
  padding: 18px 0;
  border-bottom: 1px solid #dce1e4;
}

.asset-tools {
  padding: 16px 0;
  display: grid;
  gap: 10px;
  border-bottom: 1px solid #dce1e4;
}

.asset-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px;
  align-items: center;
  gap: 8px;
}

.asset-action input[type="file"] {
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  color: #59656d;
  background: transparent;
  font-size: 11px;
}

.asset-action input[type="file"]::file-selector-button {
  margin-right: 6px;
  padding: 6px 8px;
  border: 1px solid #cbd2d7;
  border-radius: 4px;
  color: #2b353c;
  background: #ffffff;
  cursor: pointer;
}

.asset-button {
  min-height: 32px;
  padding: 6px 8px;
  border: 1px solid #9eabb3;
  border-radius: 4px;
  color: #24323b;
  background: #ffffff;
  font-size: 12px;
}

.asset-button:hover:not(:disabled) {
  border-color: #2874a6;
  color: #185982;
}

.asset-button:disabled,
.asset-action input:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.authorization-check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #4d5961;
  font-size: 12px;
  line-height: 1.4;
}

.authorization-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: 0;
  margin: 0;
  flex: 0 0 16px;
}

.asset-message {
  min-height: 17px;
  color: #59656d;
  font-size: 12px;
  line-height: 1.4;
}

.identity-heading,
.section-heading,
.log-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.lock-mark,
.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid #b9d7ca;
  border-radius: 4px;
  color: #126443;
  background: #edf7f2;
  font-size: 12px;
  white-space: nowrap;
}

.rule-list {
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
  list-style: none;
  color: #525d65;
  font-size: 13px;
}

.rule-list li::before {
  content: "✓";
  margin-right: 8px;
  color: #16835b;
}

.spec-list {
  margin: 16px 0 0;
  display: grid;
  gap: 11px;
}

.spec-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.spec-list dt,
.spec-list dd {
  margin: 0;
  font-size: 12px;
}

.spec-list dt {
  color: #717b82;
}

.spec-list dd {
  color: #252b30;
  text-align: right;
}

.production {
  padding: 22px;
  display: grid;
  align-content: start;
  gap: 22px;
}

.composer,
.job-detail {
  min-width: 0;
  border: 1px solid #d7dde1;
  border-radius: 8px;
  background: #ffffff;
}

.composer {
  padding: 20px;
}

.job-detail {
  padding: 20px;
}

.char-count,
.queue-count {
  color: #6c767d;
  font-size: 12px;
}

label {
  display: block;
  margin: 18px 0 7px;
  color: #3b444b;
  font-size: 13px;
  font-weight: 600;
}

input,
textarea {
  width: 100%;
  border: 1px solid #cbd2d7;
  border-radius: 5px;
  color: #171a1f;
  background: #ffffff;
  outline: none;
}

input {
  height: 42px;
  padding: 0 12px;
}

textarea {
  min-height: 240px;
  padding: 12px;
  resize: vertical;
  line-height: 1.75;
}

input:focus,
textarea:focus {
  border-color: #2874a6;
  box-shadow: 0 0 0 3px rgba(40, 116, 166, 0.12);
}

.composer-actions {
  min-height: 48px;
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.form-message {
  color: #a13a32;
  font-size: 13px;
}

.primary-button,
.secondary-button,
.danger-button {
  min-height: 40px;
  padding: 0 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 5px;
  font-weight: 700;
  text-decoration: none;
}

.primary-button {
  border: 1px solid #176b49;
  color: #ffffff;
  background: #176b49;
}

.primary-button:hover {
  background: #115a3d;
}

.secondary-button {
  border: 1px solid #2874a6;
  color: #1f638e;
  background: #ffffff;
}

.danger-button {
  border: 1px solid #c66b63;
  color: #9a2f28;
  background: #fff8f7;
}

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

.status-badge.neutral {
  border-color: #d3d9dd;
  color: #5c666d;
  background: #f4f6f7;
}

.status-badge.running {
  border-color: #b9d2e2;
  color: #1d638d;
  background: #eef6fb;
}

.status-badge.waiting {
  border-color: #e4cf9f;
  color: #7e5a13;
  background: #fff9e9;
}

.status-badge.failed {
  border-color: #e1b9b5;
  color: #9a2f28;
  background: #fff3f2;
}

.progress-track {
  height: 6px;
  margin: 16px 0 14px;
  overflow: hidden;
  border-radius: 3px;
  background: #e7ebed;
}

.progress-bar {
  width: 0;
  height: 100%;
  background: #16835b;
  transition: width 240ms ease;
}

.stage-list {
  min-height: 24px;
  color: #5a656c;
  font-size: 13px;
}

.progress-summary {
  min-height: 32px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.remaining-time {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: #6b757b;
  font-size: 12px;
}

.remaining-time strong {
  color: #176b49;
  font-size: 14px;
}

.media-area {
  margin-top: 16px;
  display: grid;
  place-items: center;
  min-height: 240px;
  border: 1px solid #d6dce0;
  border-radius: 6px;
  background: #171a1f;
}

.media-area.empty {
  color: #778189;
  background: #f5f7f8;
}

.media-area video {
  display: block;
  max-width: 100%;
  width: min(100%, 320px);
  max-height: 560px;
  aspect-ratio: 9 / 16;
  background: #111315;
}

.job-actions {
  min-height: 1px;
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.log-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #e0e4e7;
}

.icon-button {
  width: 32px;
  height: 32px;
  border: 1px solid #ccd3d7;
  border-radius: 4px;
  color: #3d484f;
  background: #ffffff;
  font-size: 19px;
}

.auth-page,
.share-page {
  min-height: 100vh;
  background: #f2f5f6;
}

.auth-shell {
  min-height: 100vh;
  padding: 24px;
  display: grid;
  place-items: center;
}

.auth-panel {
  width: min(100%, 420px);
  padding: 28px;
  border: 1px solid #d5dce0;
  border-radius: 6px;
  background: #ffffff;
  box-shadow: 0 12px 32px rgba(29, 43, 51, 0.08);
}

.auth-panel h1 {
  margin: 4px 0 24px;
  font-size: 24px;
}

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

.auth-panel input {
  min-height: 44px;
  margin-bottom: 8px;
  padding: 0 12px;
  border: 1px solid #cbd3d8;
  border-radius: 5px;
  font: inherit;
}

.auth-panel .primary-button {
  width: 100%;
  margin-top: 8px;
}

.share-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 20px 40px;
}

.share-shell header {
  margin-bottom: 18px;
}

.share-shell h1 {
  margin-top: 5px;
  font-size: 24px;
  line-height: 1.35;
}

.share-shell video {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  background: #111315;
}

.log-list {
  max-height: 190px;
  margin-top: 10px;
  overflow: auto;
  color: #515c63;
  font-family: Consolas, "Microsoft YaHei", monospace;
  font-size: 12px;
  line-height: 1.6;
}

.log-row {
  padding: 5px 0;
  border-bottom: 1px solid #edf0f2;
  overflow-wrap: anywhere;
}

.log-time {
  margin-right: 8px;
  color: #8a9399;
}

.queue-panel {
  padding: 20px;
  border-left: 1px solid #d9dee2;
  background: #fafbfb;
}

.job-list {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.job-row {
  width: 100%;
  padding: 12px;
  display: grid;
  gap: 7px;
  border: 1px solid #d9dfe3;
  border-radius: 6px;
  color: inherit;
  text-align: left;
  background: #ffffff;
}

.job-row:hover,
.job-row.selected {
  border-color: #84a9c1;
  background: #f5fafd;
}

.job-title {
  overflow: hidden;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #788188;
  font-size: 11px;
}

.job-mini-progress {
  height: 3px;
  overflow: hidden;
  background: #e6eaec;
}

.job-mini-progress span {
  display: block;
  height: 100%;
  background: #2874a6;
}

.empty-state {
  padding: 30px 10px;
  color: #7a848b;
  text-align: center;
  font-size: 13px;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 230px minmax(500px, 1fr);
  }

  .queue-panel {
    grid-column: 1 / -1;
    border-top: 1px solid #d9dee2;
    border-left: 0;
  }

  .job-list {
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  }
}

@media (max-width: 760px) {
  .topbar {
    padding: 14px 16px;
  }

  .topbar h1 {
    max-width: 260px;
    font-size: 20px;
    line-height: 1.25;
  }

  .topbar-actions {
    gap: 8px;
  }

  .system-state {
    min-width: 12px;
    padding: 8px 0;
  }

  #readinessText {
    display: none;
  }

  .workspace {
    display: block;
  }

  .identity-panel,
  .production,
  .queue-panel {
    padding: 16px;
    border: 0;
    border-bottom: 1px solid #d9dee2;
  }

  .identity-panel {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 16px;
  }

  .identity-copy {
    padding: 0;
    border: 0;
  }

  .spec-list {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .asset-tools {
    grid-column: 1 / -1;
    padding-top: 0;
  }

  .production {
    gap: 16px;
  }

  .composer,
  .job-detail {
    padding: 16px;
  }

  .composer-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-button {
    width: 100%;
  }

  .progress-summary {
    align-items: stretch;
    flex-direction: column;
    gap: 6px;
  }
}
