:root {
  color-scheme: light;
  font-family:
    Inter, "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: #edf1f5;
  color: #17202a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

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

button {
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  background: #ffb000;
  color: #17202a;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  min-width: 0;
}

button.secondary {
  background: #dde6ef;
  color: #243447;
}

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

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #c9d4df;
  border-radius: 8px;
  background: #ffffff;
  color: #17202a;
  outline: none;
}

input,
select {
  height: 36px;
  padding: 0 11px;
}

input[type="color"] {
  padding: 4px;
}

textarea {
  min-height: 0;
  resize: none;
  padding: 12px;
  line-height: 1.65;
}

label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  font-size: 12px;
  font-weight: 800;
  color: #344256;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.app-header {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 16px;
  border-bottom: 1px solid #d6dee8;
  background: #17202a;
  color: #f8fafc;
}

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

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #2ec4b6;
  color: #0b1720;
  font-weight: 900;
}

.brand h1,
.brand p,
.panel-title h2,
.panel-title p,
.asset-card h3,
.asset-card p {
  margin: 0;
}

.brand h1 {
  font-size: 19px;
}

.brand p,
.panel-title p {
  color: #728197;
}

.license-strip {
  display: grid;
  grid-template-columns: minmax(190px, 270px) auto auto minmax(650px, 780px);
  align-items: center;
  justify-content: end;
  gap: 12px;
  min-width: 0;
}

.license-strip label {
  color: #cbd5e1;
}

.license-actions {
  display: flex;
  gap: 8px;
  align-items: end;
}

.status {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 10px 16px;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.app-header .status {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
}

.status.error {
  background: #fee2e2;
  color: #991b1b;
}

.status.success {
  background: #dcfce7;
  color: #166534;
}

.status.muted {
  color: #64748b;
}

.license-grid {
  display: grid;
  grid-template-columns: minmax(250px, 1.1fr) minmax(260px, 1fr) minmax(110px, 0.55fr);
  align-items: stretch;
  gap: 8px;
  min-width: 0;
}

.license-metric {
  min-width: 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.license-metric span {
  flex: 0 0 auto;
  color: #9fb1c5;
  font-size: 13px;
  white-space: nowrap;
}

.license-metric strong {
  min-width: 0;
  color: #ffffff;
  font-size: 15px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: visible;
}

.license-metric-date strong {
  font-size: 15px;
}

.workbench {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(320px, 0.82fr) minmax(420px, 1.12fr) minmax(420px, 1.06fr);
  gap: 10px;
  padding: 10px;
}

.column {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel {
  min-width: 0;
  min-height: 0;
  border: 1px solid #d4dde8;
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

.panel-fill {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.script-column .prompt-panel {
  flex: 0 0 30%;
  min-height: 180px;
}

.script-column .output-panel {
  flex: 1 1 70%;
  min-height: 300px;
}

.panel-title {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-title h2 {
  font-size: 15px;
}

.panel-title p {
  margin-top: 3px;
  font-size: 12px;
}

.prompt-input,
.result-output {
  flex: 1;
}

.storyboard-column .panel {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.mode-toggle {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  font-weight: 700;
  color: #506176;
}

.mode-toggle input {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.hidden-file-input {
  display: none;
}

.asset-grid {
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: minmax(168px, auto);
  gap: 8px;
  padding-right: 2px;
}

.empty-assets {
  grid-column: 1 / -1;
  min-height: 260px;
  display: grid;
  place-items: center;
  border: 1px dashed #9fb1c5;
  border-radius: 8px;
  padding: 18px;
  background: #f8fafc;
  color: #65758b;
  text-align: center;
  line-height: 1.6;
}

.asset-card {
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 3px;
  background: transparent;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.asset-card:hover {
  border-color: #2ec4b6;
  box-shadow: none;
  transform: translateY(-1px);
}

.asset-thumb {
  position: relative;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  width: 100%;
  max-height: 150px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #ffffff;
  font-size: 28px;
  font-weight: 900;
}

.asset-preview-video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: 8px;
  background: #0f172a;
}

.asset-preview-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: repeating-linear-gradient(
    135deg,
    #1f2937,
    #1f2937 10px,
    #111827 10px,
    #111827 20px
  );
  color: #cbd5e1;
  font-size: 13px;
  font-weight: 900;
}

.asset-thumb.has-video {
  background: #0f172a;
  font-size: 0;
}

.asset-card.is-unplayable {
  opacity: 0.78;
}

.asset-card.is-unplayable:hover {
  border-color: #f97316;
}

.asset-card.is-render-source {
  border-color: #ffb000;
  box-shadow: 0 0 0 2px rgba(255, 176, 0, 0.22);
}

.tone-a {
  background: linear-gradient(145deg, #0f766e, #2ec4b6);
}

.tone-b {
  background: linear-gradient(145deg, #7c2d12, #f97316);
}

.tone-c {
  background: linear-gradient(145deg, #1d4ed8, #38bdf8);
}

.tone-d {
  background: linear-gradient(145deg, #374151, #94a3b8);
}

.tone-e {
  background: linear-gradient(145deg, #a16207, #facc15);
}

.tone-f {
  background: linear-gradient(145deg, #be123c, #fb7185);
}

.asset-card p {
  margin-top: 5px;
  color: #65758b;
  font-size: 12px;
  text-align: center;
}

.control-column {
  display: grid;
  grid-template-rows: minmax(204px, auto) minmax(0, 1fr);
}

.voice-panel,
.render-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.render-panel {
  min-height: 0;
  overflow: visible;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px 10px;
}

.wide-field {
  grid-column: 1 / -1;
}

.music-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto minmax(128px, 0.55fr);
  align-items: end;
  gap: 10px;
}

.music-row label {
  margin: 0;
}

#chooseMusicButton {
  height: 36px;
  padding: 0 12px;
}

.music-enable-field {
  min-height: 36px;
  padding-bottom: 2px;
}

.music-volume-field {
  display: grid;
  grid-template-columns: auto minmax(90px, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 36px;
}

.music-volume-field span {
  color: #344256;
  font-size: 12px;
  font-weight: 800;
}

.output-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.output-row label {
  margin: 0;
}

#chooseOutputButton {
  height: 36px;
  padding: 0 12px;
}

.subtitle-toggle {
  padding: 4px 0;
}

.pill {
  min-width: 54px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  font-size: 12px;
  font-weight: 900;
}

.render-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #65758b;
  font-size: 13px;
}

.progress-track {
  flex: 1;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: #2ec4b6;
}

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

.batch-action {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 8px;
}

.batch-action input {
  min-width: 0;
  text-align: center;
}

.batch-action button {
  min-width: 0;
}

.render-actions #openOutputButton {
  grid-column: auto;
}

.hidden {
  display: none !important;
}

.update-notice {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.62);
}

.update-card {
  width: min(520px, 100%);
  border-radius: 8px;
  padding: 24px;
  border: 1px solid #dbe5ee;
  background: #ffffff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
}

.update-card h2 {
  margin: 0 0 8px;
  color: #0f172a;
  font-size: 22px;
}

.update-version {
  margin: 0 0 14px;
  color: #475569;
}

.update-notes {
  max-height: 180px;
  margin: 0;
  padding: 12px;
  overflow: auto;
  white-space: pre-wrap;
  border-radius: 8px;
  background: #f4f7fb;
  color: #243447;
  font-family: inherit;
  line-height: 1.6;
}

.update-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

@media (max-width: 1180px) {
  .app-header,
  .license-strip {
    align-items: stretch;
  }

  .app-header {
    flex-direction: column;
  }

  .license-strip {
    width: 100%;
    grid-template-columns: minmax(180px, 1fr) auto minmax(130px, 170px);
  }

  .license-grid {
    grid-column: 1 / -1;
    grid-template-columns: minmax(230px, 1.1fr) minmax(240px, 1fr) minmax(110px, 0.55fr);
  }

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

}

@media (max-width: 760px) {
  .license-strip,
  .asset-toolbar,
  .asset-grid,
  .form-grid,
  .render-actions {
    grid-template-columns: 1fr;
  }

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

  .license-metric {
    justify-content: space-between;
  }

  .music-row {
    grid-template-columns: 1fr;
  }

  .output-row {
    grid-template-columns: 1fr;
  }
}
