:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef3f1;
  --ink: #18201f;
  --muted: #65716d;
  --line: #d9dfdc;
  --accent: #0f6b5f;
  --accent-2: #b06a1a;
  --danger: #9b2f2f;
  --shadow: 0 8px 28px rgba(22, 32, 31, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  letter-spacing: 0;
}

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

.app {
  display: grid;
  grid-template-columns: minmax(340px, 420px) minmax(0, 1fr);
  min-height: 100vh;
}

.panel,
.input-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.input-panel {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  padding: 20px;
  border-top: 0;
  border-bottom: 0;
  border-left: 0;
  box-shadow: none;
}

.brand {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 18px;
}

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

h1 {
  margin-bottom: 5px;
  font-size: 22px;
  line-height: 1.22;
}

h2 {
  margin-bottom: 12px;
  font-size: 18px;
}

.brand p,
.muted {
  color: var(--muted);
  font-size: 13px;
}

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

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

.status {
  min-width: 72px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
  white-space: nowrap;
}

.status.ready {
  border-color: rgba(15, 107, 95, 0.3);
  color: var(--accent);
  background: #eaf5f2;
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  color: #283330;
  font-size: 13px;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  background: #fff;
  color: var(--ink);
  font-weight: 400;
  line-height: 1.45;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(15, 107, 95, 0.55);
  box-shadow: 0 0 0 3px rgba(15, 107, 95, 0.1);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.duration-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.duration-grid label {
  margin-bottom: 6px;
}

.duration-note {
  margin: -2px 0 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.auto-summary {
  padding: 12px;
  margin: 4px 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.auto-summary h2 {
  margin-bottom: 6px;
  font-size: 15px;
}

.auto-summary p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.video-analysis-box {
  margin: 14px 0 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.video-analysis-box h2 {
  margin-bottom: 0;
  font-size: 15px;
}

.video-analysis-file {
  width: 100%;
  justify-content: center;
  margin: 8px 0;
}

.selected-file-name {
  min-height: 20px;
  margin: 4px 0 8px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.video-analysis-box > button {
  width: 100%;
}

.video-analysis-summary {
  max-height: 220px;
  margin-top: 10px;
  color: #3f514c;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow: auto;
}

.auto-fields {
  display: none;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

button:hover {
  border-color: #b7c3bf;
  background: #fafbfb;
}

button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

button.primary:hover {
  background: #0c5c52;
}

.work-status {
  min-height: 38px;
  margin-top: 10px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.work-status.busy {
  border-color: rgba(176, 106, 26, 0.35);
  background: #fff8ec;
  color: var(--accent-2);
}

.work-status.ready {
  border-color: rgba(15, 107, 95, 0.3);
  background: #eaf5f2;
  color: var(--accent);
}

.work-status.error {
  border-color: rgba(155, 47, 47, 0.35);
  background: #fff0f0;
  color: var(--danger);
}

.result-meta.busy {
  color: var(--accent-2);
}

.result-meta.ready {
  color: var(--accent);
}

.result-meta.error {
  color: var(--danger);
}

.generation-history {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.generation-history h2 {
  margin: 0;
  font-size: 15px;
}

.history-actions {
  display: flex;
  gap: 6px;
}

.history-card-actions {
  display: flex;
  gap: 6px;
}

.history-card-actions .danger {
  border-color: rgba(155, 47, 47, 0.28);
  color: var(--danger);
}

.history-card-actions .danger:hover {
  background: #fff3f3;
  border-color: rgba(155, 47, 47, 0.45);
}

.generation-history-list {
  display: grid;
  gap: 8px;
  max-height: 310px;
  overflow: auto;
}

.history-card {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}

.history-card h3 {
  margin: 0 0 5px;
  font-size: 13px;
  line-height: 1.4;
}

.history-card p {
  display: -webkit-box;
  margin: 0 0 7px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.history-card-meta {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
}

.history-card button {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 12px;
}

.workspace {
  padding: 18px;
  min-width: 0;
}

.story-preview-panel {
  margin-bottom: 14px;
}

.story-preview-meta {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
}

.story-preview {
  max-height: 420px;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  white-space: pre-wrap;
  color: var(--text);
  font-size: 14px;
  line-height: 1.8;
}

.episode-memory-panel {
  margin-bottom: 14px;
}

.episode-memory {
  max-height: 420px;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f3f7f6;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.75;
}

.episode-memory-heading {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 16px;
}

.episode-memory-section {
  margin: 14px 0 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.episode-memory-block {
  white-space: pre-wrap;
}

.episode-memory-rule {
  margin: 8px 0;
  padding-left: 18px;
}

.episode-memory-rule li + li {
  margin-top: 5px;
}

.story-preview-heading {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 16px;
}

.story-preview-section {
  margin: 14px 0 5px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.story-preview-shot {
  margin: 8px 0;
  padding: 10px;
  border-left: 3px solid var(--accent);
  background: var(--surface);
}

.story-preview-shot strong {
  display: block;
  margin-bottom: 4px;
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  gap: 4px;
  padding: 8px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(246, 247, 249, 0.92);
  backdrop-filter: blur(10px);
}

.tab {
  flex: 1;
  min-width: 0;
}

.tab.active {
  border-color: var(--accent);
  background: #eaf5f2;
  color: var(--accent);
  font-weight: 700;
}

.tab-page {
  display: none;
}

.tab-page.active {
  display: block;
}

.panel {
  padding: 18px;
  border-radius: 8px;
  margin-bottom: 14px;
}

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

.summary-strip div {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.summary-strip strong {
  display: block;
  font-size: 25px;
  color: var(--accent);
}

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

.flow {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
}

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

.shot-card,
.shot-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.shot-card {
  padding: 14px;
}

.shot-card h3,
.shot-item h3 {
  margin-bottom: 8px;
  font-size: 15px;
}

.shot-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.pill {
  padding: 4px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  color: #3f514c;
  font-size: 12px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.section-head.compact {
  margin-bottom: 6px;
}

.section-head h2 {
  margin-bottom: 0;
}

.story-actions {
  margin: -2px 0 14px;
}

.reference-box {
  margin: 14px 0 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfc;
}

.reference-box h2 {
  font-size: 15px;
}

.file-button {
  display: inline-flex;
  width: auto;
  min-height: 34px;
  margin: 0;
  padding: 7px 10px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: #eaf5f2;
  color: var(--accent);
  cursor: pointer;
  align-items: center;
}

.file-button input {
  display: none;
}

.reference-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.empty-ref {
  padding: 12px;
  border: 1px dashed #c6d0cc;
  border-radius: 6px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.ref-card {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
}

.ref-card img,
.ref-placeholder {
  width: 70px;
  height: 70px;
  border: 1px solid var(--line);
  border-radius: 6px;
  object-fit: cover;
  background: var(--surface-2);
}

.ref-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
}

.ref-fields {
  display: grid;
  gap: 6px;
}

.ref-fields input {
  padding: 7px 8px;
  font-size: 12px;
}

.ref-card button {
  min-height: 32px;
  padding: 6px 8px;
  color: var(--danger);
}

.prompt-box {
  min-height: 220px;
  font-family: "Microsoft YaHei", Arial, sans-serif;
}

.result-box {
  margin-top: 12px;
}

.canvas-batch-area {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.canvas-batch-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.canvas-batch-toolbar .result-meta {
  margin: 0;
}

.canvas-batch-progress {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.canvas-batch-progress[hidden] {
  display: none;
}

.canvas-batch-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
}

.canvas-batch-progress-head strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.canvas-batch-progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7e1d7;
}

.canvas-batch-progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 180ms ease;
}

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

.canvas-batch-card {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.canvas-card-actions {
  margin-top: 10px;
}

.canvas-card-actions-failed {
  margin-top: 8px;
}

.canvas-card-actions-failed .primary {
  flex: 1 1 100%;
  font-weight: 700;
}

.canvas-card-actions button {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 12px;
}

.canvas-repair-panel {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.canvas-repair-panel[hidden] {
  display: none;
}

.canvas-repair-panel h3 {
  margin: 0;
  font-size: 16px;
}

.repair-canvas-wrap {
  display: grid;
  place-items: center;
  min-height: 240px;
  margin: 12px 0;
  padding: 10px;
  overflow: auto;
  border: 1px dashed var(--accent-2);
  border-radius: 8px;
  background: #fffaf1;
}

#repairCanvas {
  display: block;
  max-width: min(100%, 600px);
  height: auto;
  cursor: crosshair;
  touch-action: none;
  box-shadow: var(--shadow);
}

.repair-brush-label {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 12px;
  font-weight: 400;
}

.repair-brush-label input {
  width: 150px;
  padding: 0;
}

.canvas-batch-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 8px;
}

.canvas-batch-head h4 {
  margin: 0 0 4px;
  font-size: 14px;
}

.canvas-batch-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.canvas-batch-image {
  width: 100%;
  height: auto;
  max-height: 220px;
  object-fit: cover;
}

.result-meta {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.canvas-quality-notice {
  margin: 0.75rem 0 1rem;
}

.canvas-quality {
  margin: 8px 0;
  padding: 8px 10px;
  border-left: 3px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.canvas-quality.quality-passed {
  border-left-color: #2f855a;
}

.canvas-quality.quality-repaired {
  border-left-color: #c47a14;
}

.canvas-quality.quality-repaired_with_warnings {
  border-left-color: #c47a14;
}

.canvas-quality.quality-unavailable,
.canvas-quality.quality-repair_failed {
  border-left-color: #c53030;
}

.quality-label {
  color: var(--text);
  font-weight: 700;
}

.quality-count {
  margin-left: 8px;
}

.quality-summary {
  margin-top: 4px;
}

.result-box img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  image-rendering: auto;
}

.image-preview-button {
  display: block;
  width: fit-content;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: zoom-in;
}

.image-preview-button:hover img {
  border-color: var(--accent);
  box-shadow: 0 6px 18px rgba(15, 107, 95, 0.16);
}

.ref-preview {
  display: block;
  width: 150px;
  height: 110px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface-2);
}

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

.archive-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.archive-image {
  display: block;
  width: 150px;
  height: 110px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface-2);
}

.archive-image.empty,
.archive-thumb.empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
}

.archive-thumbs {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  overflow: hidden;
}

.archive-thumbs .image-preview-button {
  flex: 0 0 auto;
}

.archive-thumb {
  width: 92px;
  height: 64px;
  border: 1px solid var(--line);
  border-radius: 6px;
  object-fit: cover;
  background: var(--surface-2);
  flex: 0 0 auto;
}

.image-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  place-items: center;
  padding: 24px;
}

.image-modal.active {
  display: grid;
}

.image-modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(18, 24, 22, 0.68);
  cursor: zoom-out;
}

.image-modal-panel {
  position: relative;
  z-index: 1;
  width: min(920px, 94vw);
  max-height: 92vh;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
}

.image-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.image-modal-head h2 {
  margin: 0;
  font-size: 15px;
  color: var(--accent);
}

.image-modal-panel img {
  display: block;
  width: 100%;
  max-height: calc(92vh - 76px);
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
  background: var(--surface-2);
}

.archive-card h4 {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--accent);
}

.archive-card p {
  margin: 5px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.shot-list {
  display: grid;
  gap: 12px;
}

.shot-item {
  padding: 14px;
}

.shot-layout {
  display: grid;
  grid-template-columns: minmax(180px, 0.62fr) minmax(260px, 1fr);
  gap: 14px;
}

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

.shot-meta b {
  color: var(--ink);
}

.mini-prompt {
  min-height: 150px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfc;
  white-space: pre-wrap;
  color: #26312e;
  font-size: 13px;
  line-height: 1.55;
}

.video-result {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.video-result a,
.button-link {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.error-text {
  color: var(--danger);
}

.final-video-panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.final-video-player {
  display: block;
  width: min(100%, 360px);
  aspect-ratio: 9 / 16;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111;
}

.final-video-actions {
  margin-top: 10px;
}

.log {
  min-height: 130px;
  margin: 12px 0 0;
  padding: 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #1c2321;
  color: #d8eee7;
  font-size: 12px;
  line-height: 1.5;
}

.segment-video-panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

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

.segment-video-card {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.segment-video-card.is-complete {
  border-color: #7eb9a5;
}

.segment-video-card.is-failed {
  border-color: #d58b84;
}

.segment-video-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.segment-video-card-head strong {
  display: block;
  color: var(--text);
  font-size: 13px;
}

.segment-video-title {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.segment-video-player {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #111;
  object-fit: contain;
}

.segment-video-placeholder {
  display: grid;
  place-items: center;
  min-height: 220px;
  padding: 20px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.segment-video-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 9px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.segment-video-meta a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.divider {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 16px 0;
}

.production-board-section {
  margin: 16px 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.production-board-section h3,
.production-board-section h4 {
  margin: 0 0 6px;
}

.master-board-wrap {
  margin-top: 12px;
}

.master-board-result {
  min-height: 180px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}

.master-board-result .production-board-image {
  display: block;
  width: min(100%, 760px);
  max-height: 420px;
  margin: 0 auto;
  object-fit: contain;
}

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

.production-board-card {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}

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

.local-keyframe-cell {
  position: relative;
  min-width: 0;
}

.local-keyframe-cell > span {
  position: absolute;
  z-index: 1;
  top: 5px;
  left: 5px;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: #182329;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.local-keyframe-cell .image-preview-button,
.local-keyframe-empty {
  display: block;
  width: 100%;
  min-height: 155px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
}

.local-keyframe-cell .local-keyframe-image {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
}

.local-keyframe-empty {
  display: grid;
  place-items: center;
  padding: 8px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.local-keyframe-cell small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.production-board-card .image-preview-button {
  display: block;
  width: 100%;
  padding: 0;
}

.production-board-card .canvas-batch-head {
  margin-bottom: 8px;
}

.production-board-pills {
  margin: 8px 0 6px;
}

.production-board-timeline {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.production-board-timeline span {
  padding: 7px 8px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.production-board-card .canvas-task-id,
.production-board-card .canvas-error {
  margin: 7px 0 0;
}

.cover-generation-section {
  margin: 16px 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.cover-generation-section h3 {
  margin: 0 0 6px;
}

.cover-prompt-box {
  min-height: 150px;
}

.cover-title-field {
  display: grid;
  gap: 6px;
  margin: 10px 0;
  font-weight: 700;
}

.cover-title-field input {
  font-size: 18px;
  font-weight: 700;
}

.cover-actions {
  margin-top: 10px;
}

.cover-result {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  min-height: 80px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}

.cover-result .cover-image {
  display: block;
  width: min(100%, 360px);
  max-height: 560px;
  object-fit: contain;
}

.cover-result .image-preview-button {
  margin: 0 auto;
}

.cover-download-row {
  display: flex;
  justify-content: center;
}

.cover-download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 16px;
  border-radius: 5px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
}

.cover-download-button:hover {
  filter: brightness(.94);
}

.cover-result-meta {
  color: var(--muted);
  font-size: 12px;
}

.cover-error {
  color: var(--danger);
  font-size: 13px;
}

@media (max-width: 960px) {
  .app {
    grid-template-columns: 1fr;
  }

  .input-panel {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .shot-layout,
  .grid-2,
  .summary-strip {
    grid-template-columns: 1fr;
  }

  .tabs {
    overflow-x: auto;
  }

  .tab {
    min-width: 96px;
  }
}
.material-url-results {
  margin-top: 10px;
  display: grid;
  gap: 6px;
}

.material-url-summary {
  font-weight: 700;
  color: var(--ink);
}

.material-url-item {
  display: grid;
  grid-template-columns: minmax(120px, 0.7fr) minmax(0, 2fr) auto;
  gap: 8px;
  align-items: center;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.material-url-item a {
  min-width: 0;
  overflow-wrap: anywhere;
}

.material-url-item.ok strong { color: #13795b; }
.material-url-item.failed strong { color: #b42318; }

@media (max-width: 720px) {
  .material-url-item { grid-template-columns: 1fr; }
}
