:root {
  --bg: #080a0d;
  --panel: rgba(18, 21, 25, 0.86);
  --border: rgba(255,255,255,0.1);
  --text: #f7f7f5;
  --muted: #9b9fa6;
  --accent: #00c288;
  --accent2: #009d70;
  --cn: #dc2626;
  --cn2: #b91c1c;
  --success: #10b981;
  --warn: #f59e0b;
  --studio-width: 980px;
  --studio-gap: 34px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { min-height: 100%; scroll-behavior: smooth; }
body {
  font-family: 'Geist', 'Noto Sans SC', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  background-image: linear-gradient(180deg, #0c0e12 0, #080a0d 520px);
}
.app { display: flex; flex-direction: column; min-height: 100vh; padding: 0 22px 40px; gap: 12px; max-width: 1800px; margin: 0 auto; }
header {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  padding: 18px 2px; background: rgba(8,10,13,0.76); border: 0; border-bottom: 1px solid var(--border);
  border-radius: 0; backdrop-filter: blur(18px);
  position: sticky; top: 0; z-index: 40;
}
header h1 { font-size: 20px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.workspace-context {
  min-width: 0; display: grid; gap: 2px; padding-left: 14px; border-left: 1px solid var(--border);
}
.workspace-context span { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.workspace-context strong { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.resource-button {
  order: 20; margin-left: auto; display: inline-flex; align-items: center; gap: 7px; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: 9px; background: rgba(255,255,255,0.04);
  color: #d1d5db; font-size: 13px; font-weight: 700; cursor: pointer;
}
.account-button {
  order: 21; display: inline-flex; align-items: center; gap: 7px; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: 9px; background: transparent;
  color: #d1d5db; font-size: 12px; cursor: pointer;
}
.account-button:hover { border-color: rgba(0,194,136,.5); color: #fff; }
.resource-button:hover,
.resource-button.active { border-color: rgba(147,197,253,0.45); color: #bfdbfe; background: rgba(59,130,246,0.1); }
.lib-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.lib-tab {
  padding: 8px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: transparent; color: var(--muted); font-size: 13px; cursor: pointer;
}
.lib-tab.active { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; border-color: transparent; }
.lib-tab.active.cn { background: linear-gradient(135deg, var(--cn), var(--cn2)); }
.stats { display: flex; gap: 16px; margin-left: auto; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.stats strong { color: var(--text); }
.search-box { flex: 1; min-width: 200px; max-width: 360px; position: relative; }
.search-box input {
  width: 100%; padding: 10px 14px 10px 38px; border-radius: 10px;
  border: 1px solid var(--border); background: rgba(0,0,0,0.25); color: var(--text); font-size: 14px;
}
.search-box i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.header-actions { display: flex; gap: 8px; }
.header-actions a, .header-actions button {
  padding: 8px 12px; border-radius: 10px; font-size: 13px; text-decoration: none;
  border: 1px solid var(--border); background: rgba(255,255,255,0.04); color: var(--text); cursor: pointer;
}
.header-actions a:hover { border-color: var(--accent); color: #93c5fd; }
.creator-view { flex: 1; min-height: 0; overflow: visible; }
.creator-start,
.workflow-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  backdrop-filter: blur(16px);
}
.creator-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; min-height: 0; overflow: visible; }
.creator-start {
  position: relative; min-height: 0; padding: 34px 24px 40px; display: flex; flex-direction: column; align-items: center; gap: var(--studio-gap);
  border: none; border-radius: 0; backdrop-filter: none;
  background: transparent;
  overflow: hidden;
}
.creator-start::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(circle at var(--mx, 50%) var(--my, 24%), rgba(0,194,136,0.12), transparent 30%),
    linear-gradient(180deg, rgba(255,255,255,0.035), transparent 260px);
  opacity: 0.9;
}
.creator-start > * { position: relative; z-index: 1; }
.start-copy { width: min(var(--studio-width), 100%); text-align: center; margin: 0 auto 2px; }
.start-copy .eyebrow {
  display: inline-flex; padding: 5px 9px; border: 1px solid rgba(0,194,136,0.35);
  border-radius: 999px; background: rgba(0,194,136,0.08); color: #6ee7b7;
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
}
.start-copy h2 { font-size: clamp(34px, 5vw, 56px); line-height: 1.04; margin: 12px auto 10px; max-width: 760px; letter-spacing: 0; }
.start-copy > p:not(.eyebrow) { color: #d1d5db; line-height: 1.65; font-size: 16px; max-width: 680px; margin: 0 auto; }
.start-box {
  width: min(var(--studio-width), 100%); padding: 6px 0 0; border: none; border-radius: 0;
  background: transparent; box-shadow: none; transition: none;
}
.start-box:hover { transform: none; }
.creator-steps {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px;
  margin: 0 auto 18px; max-width: 760px;
}
.creator-steps span {
  position: relative; min-height: 34px; display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,0.08); border-radius: 10px;
  background: rgba(255,255,255,0.035); color: #cbd5e1; font-size: 12px; font-weight: 700;
}
.creator-steps span::before {
  content: "0" counter(step); counter-increment: step; margin-right: 6px; color: #6ee7b7;
}
.creator-steps { counter-reset: step; }
.creator-steps span + span::after {
  content: ""; position: absolute; left: -9px; top: 50%; width: 8px; height: 1px;
  background: rgba(110,231,183,0.35);
}
.start-box textarea {
  width: 100%; resize: vertical; min-height: 142px; border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px; background: rgba(3,7,18,0.46); color: var(--text);
  padding: 18px; font: inherit; font-size: 17px; line-height: 1.65;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.045), 0 14px 50px rgba(0,0,0,0.18);
  backdrop-filter: blur(14px);
}
.start-box textarea:focus {
  outline: none; border-color: rgba(0,194,136,0.65); box-shadow: 0 0 0 3px rgba(0,194,136,0.12), inset 0 1px 0 rgba(255,255,255,0.045);
}
.template-section {
  position: relative; width: min(var(--studio-width), 100%); padding: 0 0 4px;
}
.operation-section-head { margin: 0 0 14px; }
.operation-section-head h3 { font-size: 18px; margin-bottom: 4px; letter-spacing: 0; }
.operation-section-head p { color: var(--muted); font-size: 13px; line-height: 1.5; }
.template-picker {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px; overflow: visible;
  padding: 4px 0 12px; perspective: 900px; scrollbar-width: none;
}
.template-picker::-webkit-scrollbar { display: none; }
.template-picker::-webkit-scrollbar-thumb { background: rgba(0,194,136,0.35); border-radius: 999px; }
.template-card {
  position: relative; min-height: 276px; text-align: left; color: var(--text); border: 1px solid rgba(255,255,255,0.09);
  border-radius: 14px; background: rgba(255,255,255,0.035); cursor: pointer;
  padding: 0; display: flex; flex-direction: column; overflow: hidden; scroll-snap-align: start;
  transform-style: preserve-3d; transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  backdrop-filter: blur(10px);
}
.template-card::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at var(--card-x, 50%) var(--card-y, 30%), rgba(255,255,255,0.18), transparent 34%);
  opacity: 0; transition: opacity 0.18s ease;
}
.template-card:hover { border-color: rgba(0,194,136,0.44); background: rgba(255,255,255,0.058); box-shadow: 0 16px 44px rgba(0,0,0,0.28); }
.template-card:hover::after { opacity: 1; }
.template-cover,
.template-video-media {
  position: relative; display: block; background: #111827; overflow: hidden; isolation: isolate;
}
.template-cover { height: 156px; }
.template-cover img,
.template-cover video,
.template-video-media img,
.template-video-media video {
  width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0.86;
  transition: transform 0.5s ease, filter 0.5s ease;
}
.is-motion-poster img { animation: motionPoster 8s ease-in-out infinite alternate; }
.template-cover::after,
.template-video-media::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: linear-gradient(180deg, rgba(0,0,0,0.02), rgba(0,0,0,0.22));
}
.template-card:hover .template-cover img,
.template-card:hover .template-cover video { transform: scale(1.06); filter: saturate(1.08) contrast(1.05); }
.media-badge {
  position: absolute; left: 12px; bottom: 12px; z-index: 2; display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 9px; border-radius: 999px; background: rgba(0,0,0,0.58); color: #fff;
  font-size: 11px; font-weight: 800; backdrop-filter: blur(10px);
}
.template-info { padding: 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.template-card strong { font-size: 17px; letter-spacing: 0; }
.template-card small { display: block; color: var(--muted); font-size: 13px; line-height: 1.45; }
.template-card em { margin-top: auto; color: #6ee7b7; font-style: normal; font-size: 13px; font-weight: 800; }
.template-card.active { border-color: rgba(0,194,136,0.78); background: rgba(0,194,136,0.13); box-shadow: 0 0 0 1px rgba(0,194,136,0.38); }
.quick-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.quick-row span { color: var(--muted); font-size: 12px; }
.quick-row button,
.shot-actions button,
.shot-upload {
  border: 1px solid rgba(255,255,255,0.09); background: rgba(255,255,255,0.035); color: var(--text);
  border-radius: 999px; padding: 6px 10px; font-size: 12px; cursor: pointer;
}
.quick-row button:hover,
.shot-actions button:hover,
.shot-upload:hover { border-color: rgba(59,130,246,0.5); color: #93c5fd; }
.advanced-options { margin-top: 14px; border: 1px solid rgba(255,255,255,0.08); border-radius: 12px; background: rgba(255,255,255,0.018); }
.advanced-options summary { padding: 11px 12px; cursor: pointer; color: #93c5fd; font-size: 13px; font-weight: 700; }
.auto-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.advanced-options .auto-options { margin: 0; padding: 0 12px 12px; }
.auto-options label { display: flex; flex-direction: column; gap: 6px; }
.auto-options span { color: var(--muted); font-size: 12px; }
.auto-options select {
  border: 1px solid var(--border); border-radius: 10px; background: rgba(0,0,0,0.22);
  color: var(--text); padding: 10px; font: inherit; font-size: 13px;
}
.start-generate.btn-primary {
  width: 100%; min-height: 56px; margin-top: 12px; font-size: 16px;
  background: linear-gradient(135deg, #00c288, #0f8f70); box-shadow: 0 14px 34px rgba(0,194,136,0.18);
}
.start-generate.btn-primary:hover { filter: brightness(1.06); transform: translateY(-1px); }
.workflow-card { padding: 16px; min-height: 0; }
.workflow-card.is-empty { opacity: 0.86; }
.back-to-templates {
  display: inline-flex; align-items: center; gap: 7px; margin-bottom: 10px;
  border: 1px solid var(--border); background: rgba(255,255,255,0.05);
  color: #d1d5db; border-radius: 999px; padding: 7px 11px; font-size: 13px; cursor: pointer;
}
.back-to-templates:hover { border-color: rgba(147,197,253,0.5); color: #93c5fd; }
.plan-empty {
  min-height: 180px; border: 1px dashed rgba(147,197,253,0.25); border-radius: 14px;
  display: grid; place-items: center; align-content: center; gap: 8px; color: var(--muted);
}
.plan-empty i { font-size: 26px; color: #93c5fd; }
.plan-empty strong { color: var(--text); font-size: 17px; }
.workflow-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 14px; flex-wrap: wrap; }
.history-button {
  display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 7px 10px;
  border: 1px solid rgba(255,255,255,.12); border-radius: 5px; background: transparent;
  color: #aeb5bc; cursor: pointer; font-size: 11px;
}
.history-button:hover { border-color: rgba(0,194,136,.5); color: #dce2e6; }
.history-button span {
  min-width: 18px; padding: 2px 5px; border-radius: 999px; background: rgba(0,194,136,.12);
  color: #6ee7b7; font-size: 9px; text-align: center;
}
.eyebrow { color: #93c5fd; font-size: 12px; margin-bottom: 5px; }
.workflow-head h2 { font-size: 21px; }
.workflow-actions {
  position: sticky; bottom: 12px; z-index: 20; display: grid; grid-template-columns: minmax(0,1fr) repeat(2, minmax(170px, 240px));
  gap: 16px; align-items: center; margin: 14px 0 18px; padding: 14px;
  border: 1px solid rgba(110,231,183,0.3); border-radius: 12px;
  background: rgba(13,20,31,0.94); box-shadow: 0 14px 38px rgba(0,0,0,0.32); backdrop-filter: blur(18px);
}
.workflow-actions .btn { width: 100%; min-height: 52px; padding: 13px 18px; font-size: 15px; box-shadow: 0 8px 24px rgba(37,99,235,0.24); }
.workflow-actions .btn-secondary { box-shadow: none; }
.workflow-actions .btn-secondary.active { border-color: rgba(0,194,136,.62); color: #6ee7b7; background: rgba(0,194,136,.1); }
.next-action-copy { display: grid; gap: 3px; }
.next-action-copy span { color: #6ee7b7; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.next-action-copy strong { font-size: 14px; }
.btn:disabled { cursor: not-allowed; opacity: 0.42; filter: grayscale(0.25); transform: none !important; }
.template-video-panel { 
  display: grid; grid-template-columns: minmax(280px, 42%) minmax(0, 1fr); gap: 16px; align-items: center;
  padding: 12px; margin-bottom: 14px; border: 1px solid rgba(255,255,255,0.09);
  border-radius: 14px; background: rgba(255,255,255,0.035);
}
.template-adapt-panel {
  display: grid; grid-template-columns: minmax(220px, 0.8fr) minmax(360px, 1.4fr); gap: 28px;
  padding: 24px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.template-adapt-copy { display: grid; align-content: center; gap: 7px; }
.template-adapt-copy span,
.template-structure-head span { color: #6ee7b7; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.template-adapt-copy h3,
.template-structure-head h3 { font-size: 20px; }
.template-adapt-copy p { color: var(--muted); font-size: 13px; line-height: 1.7; max-width: 420px; }
.template-adapt-form { display: grid; gap: 10px; }
.template-adapt-form textarea {
  width: 100%; min-height: 108px; resize: vertical; padding: 14px; border: 1px solid var(--border);
  border-radius: 10px; background: rgba(0,0,0,0.2); color: var(--text); font: 14px/1.65 inherit;
}
.template-adapt-form textarea:focus { outline: none; border-color: rgba(110,231,183,0.5); }
.template-adapt-actions { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 10px; align-items: center; }
.reference-upload {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 9px; background: rgba(255,255,255,0.05);
  color: #bfdbfe; font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.reference-upload input { display: none; }
.template-adapt-actions span { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.template-adapt-actions .btn { padding: 11px 16px; white-space: nowrap; }
.template-structure { display: grid; gap: 16px; padding-top: 6px; }
.template-structure-head { display: grid; gap: 5px; }
.template-shot-preview { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.template-preview-shot { min-width: 0; display: grid; gap: 8px; }
.template-preview-media { position: relative; aspect-ratio: 16 / 10; overflow: hidden; border-radius: 8px; background: #111; }
.template-preview-media img,
.template-preview-media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.template-preview-media span {
  position: absolute; left: 7px; top: 7px; padding: 3px 6px; border-radius: 6px;
  background: rgba(0,0,0,0.66); color: #fff; font-size: 10px; font-weight: 700;
}
.template-preview-shot strong { font-size: 12px; line-height: 1.4; }
.template-preview-shot p { color: var(--muted); font-size: 10px; line-height: 1.45; }
.adaptation-result {
  display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px;
  border: 1px solid rgba(110,231,183,0.25); border-radius: 12px; background: rgba(16,185,129,0.08);
}
.adaptation-result div { display: grid; gap: 4px; }
.adaptation-result span { color: #6ee7b7; font-size: 11px; font-weight: 700; }
.adaptation-result h3 { font-size: 17px; }
.adaptation-result p { color: var(--muted); font-size: 12px; line-height: 1.5; }
.generated-video-result {
  display: grid; grid-template-columns: minmax(220px, 0.7fr) minmax(360px, 1.3fr); gap: 20px;
  padding: 18px; border: 1px solid rgba(110,231,183,0.25); border-radius: 12px; background: rgba(16,185,129,0.055);
}
.generated-video-result > div:first-child { display: grid; align-content: center; gap: 6px; }
.generated-video-result span { color: #6ee7b7; font-size: 11px; font-weight: 700; }
.generated-video-result h3 { font-size: 18px; }
.generated-video-result p { color: var(--muted); font-size: 12px; line-height: 1.6; }
.generated-video-media { aspect-ratio: 16 / 9; overflow: hidden; border-radius: 9px; background: #080b12; }
.generated-video-media video { width: 100%; height: 100%; object-fit: contain; display: block; }
.template-video-media {
  aspect-ratio: 16 / 9; max-height: 360px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.08);
}
.template-video-media .media-badge { left: 14px; bottom: 14px; }
.template-video-copy { display: grid; gap: 8px; align-content: center; min-width: 0; }
.template-video-copy span {
  color: #6ee7b7; font-size: 12px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase;
}
.template-video-copy h3 { font-size: 20px; letter-spacing: 0; }
.template-video-copy p { color: var(--muted); font-size: 13px; line-height: 1.7; max-width: 560px; }
.template-proof {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-top: 8px;
  border-top: 1px solid rgba(255,255,255,.09);
  border-bottom: 1px solid rgba(255,255,255,.09);
}
.template-proof span {
  display: grid;
  gap: 3px;
  min-width: 145px;
  padding: 11px 18px 11px 0;
  color: #b5bbc1;
  font-size: 10px;
}
.template-proof b {
  color: #6f7881;
  font-size: 8px;
  font-weight: 600;
}
.character-section {
  margin: 20px 0 16px; padding: 16px 0; border: 0;
  border-top: 1px solid rgba(255,255,255,0.1); border-bottom: 1px solid rgba(255,255,255,0.1);
  border-radius: 0; background: transparent;
}
.character-section-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 10px;
}
.character-head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.character-head-actions .btn { min-height: 36px; padding: 8px 11px; border-radius: 5px; font-size: 12px; }
.character-section-head > div:first-child { display: grid; gap: 4px; }
.character-section-head span { color: #6ee7b7; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.character-section-head h3 { font-size: 18px; letter-spacing: 0; }
.character-section-head p { display: none; }
.character-lock-status {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; border: 1px solid rgba(0,194,136,0.28);
  border-radius: 5px; padding: 7px 10px; background: rgba(0,194,136,0.08); color: #6ee7b7; font-size: 12px; font-weight: 800;
}
.character-picker { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.character-avatar {
  width: 66px; min-width: 66px; display: grid; gap: 5px; justify-items: center; border: 0; padding: 0;
  background: transparent; color: var(--muted); cursor: default;
}
.character-avatar img {
  width: 52px; height: 52px; border: 2px solid rgba(0,194,136,.72); border-radius: 50%;
  object-fit: cover; object-position: top; background: #fff; box-shadow: 0 0 0 3px rgba(0,194,136,.1);
}
.character-avatar span {
  width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; text-align: center;
}
.character-avatar .generated-character-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px dashed rgba(0, 194, 136, .5);
  border-radius: 50%;
  color: var(--accent);
  background: rgba(0, 194, 136, .08);
}
.character-option {
  min-width: 0; display: grid; grid-template-columns: 84px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 10px; border: 1px solid rgba(255,255,255,0.09); border-radius: 6px; background: rgba(255,255,255,0.025);
  color: var(--text); text-align: left; cursor: pointer; transition: border-color 0.18s ease, background 0.18s ease;
}
.character-option:hover { border-color: rgba(0,194,136,0.4); background: rgba(255,255,255,0.045); }
.character-option.selected { border-color: rgba(0,194,136,0.72); background: rgba(0,194,136,0.09); }
.character-option img { width: 84px; height: 96px; object-fit: cover; object-position: top; border-radius: 8px; background: #fff; }
.character-option-copy { min-width: 0; display: grid; gap: 5px; }
.character-option-copy strong { font-size: 15px; }
.character-option-copy small { color: var(--muted); font-size: 12px; line-height: 1.45; }
.character-role {
  width: fit-content; border: 1px solid rgba(147,197,253,0.25); border-radius: 999px;
  padding: 4px 7px; color: #bfdbfe; background: rgba(59,130,246,0.08); font-size: 11px; font-weight: 700;
}
.character-check {
  width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid var(--border);
  border-radius: 50%; color: transparent; background: rgba(255,255,255,0.04);
}
.character-option.selected .character-check { border-color: #00c288; background: #00c288; color: #04130e; }
.generated-shot-facts { display: flex; flex-wrap: wrap; gap: 6px; }
.generated-shot-facts span {
  display: inline-flex; gap: 5px; padding: 5px 7px; border: 1px solid var(--border); border-radius: 4px;
  color: #b5bac1; font-size: 10px; line-height: 1.4;
}
.generated-shot-facts b { color: #69e4bd; font-weight: 700; }
.generated-shot-facts .shot-narration { width: 100%; }
.shot-output-details { border-top: 1px solid var(--border); }
.shot-output-details summary { padding: 9px 0 0; color: #79e8c4; font-size: 11px; font-weight: 700; cursor: pointer; }
.shot-output-details > div { display: grid; gap: 4px; padding-top: 9px; }
.shot-output-details b { color: #b9bec5; font-size: 10px; }
.shot-output-details p { color: #8f959d; font-size: 10px; line-height: 1.55; }
.character-library-modal {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 28px;
  background: rgba(0,0,0,.68); backdrop-filter: blur(14px);
}
.character-library-dialog {
  width: min(1280px, 100%); max-height: min(900px, calc(100vh - 56px)); display: grid;
  grid-template-rows: auto auto minmax(0,1fr) auto; overflow: hidden; border: 1px solid rgba(255,255,255,.15);
  border-radius: 8px; background: #111418; box-shadow: 0 30px 100px rgba(0,0,0,.55);
}
.character-library-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 22px 24px 18px;
  border-bottom: 1px solid var(--border);
}
.character-library-head > div { display: grid; gap: 5px; }
.character-library-head span { color: #69e4bd; font-size: 11px; font-weight: 700; }
.character-library-head h2 { font-size: 24px; }
.character-library-head p { color: var(--muted); font-size: 12px; }
.icon-button {
  width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--border);
  border-radius: 5px; background: transparent; color: var(--text); cursor: pointer;
}
.character-library-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 24px;
  border-bottom: 1px solid var(--border);
}
.character-filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.character-filter-chips button {
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 5px; background: transparent;
  color: var(--muted); font-size: 11px; cursor: pointer;
}
.character-filter-chips button.active { border-color: rgba(0,194,136,.45); background: rgba(0,194,136,.1); color: #79e8c4; }
.character-library-toolbar > span { color: #aeb3ba; font-size: 12px; white-space: nowrap; }
.character-library-grid {
  overflow-y: auto; display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 22px 14px; padding: 20px 24px 28px;
}
.character-library-item { min-width: 0; display: grid; gap: 8px; border: 0; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.character-library-photo {
  position: relative; display: block; aspect-ratio: 4 / 5; overflow: hidden; border: 1px solid var(--border); border-radius: 6px; background: #ecebea;
}
.character-library-photo img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.character-library-photo em {
  position: absolute; left: 8px; top: 8px; padding: 4px 6px; border-radius: 4px; background: #00c288;
  color: #03120d; font-size: 9px; font-style: normal; font-weight: 800;
}
.character-library-photo i {
  position: absolute; right: 8px; top: 8px; width: 24px; height: 24px; display: grid; place-items: center;
  border: 1px solid rgba(0,0,0,.28); border-radius: 5px; background: rgba(255,255,255,.82); color: transparent;
}
.character-library-item.selected .character-library-photo { border-color: #00c288; box-shadow: 0 0 0 2px rgba(0,194,136,.18); }
.character-library-item.selected .character-library-photo i { background: #00c288; color: #03120d; border-color: #00c288; }
.character-library-item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.character-library-item small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 11px; }
.character-library-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 24px;
  border-top: 1px solid var(--border); background: #0d1013;
}
.character-library-footer p { color: var(--muted); font-size: 11px; }
.character-library-footer > div { display: flex; gap: 8px; }
.character-library-footer .btn { min-width: 120px; min-height: 42px; border-radius: 5px; }
.shot-characters { display: flex; align-items: center; gap: 5px; }
.shot-characters img {
  width: 22px; height: 22px; border: 1px solid rgba(255,255,255,0.22); border-radius: 50%;
  object-fit: cover; object-position: top; background: #fff;
}
.generation-status {
  display: grid; gap: 12px; margin-bottom: 14px; padding: 14px;
  border: 1px solid rgba(0,194,136,0.22); border-radius: 12px; background: rgba(0,194,136,0.055);
}
.generation-status-copy { display: grid; gap: 4px; }
.generation-status-copy span { color: #6ee7b7; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.generation-status-copy strong { font-size: 16px; }
.generation-status-copy p { color: var(--muted); font-size: 13px; line-height: 1.5; }
.generation-progress { height: 5px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,0.08); }
.generation-progress span {
  display: block; width: var(--generation-progress, 0%); height: 100%; border-radius: inherit;
  background: #00c288; transition: width 0.35s ease;
}
.director-plan {
  margin-top: 2px; border: 1px solid rgba(255,255,255,0.09); border-radius: 12px;
  background: rgba(255,255,255,0.02); overflow: hidden;
}
.director-plan summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 14px;
  color: #d1d5db; cursor: pointer; font-size: 13px; font-weight: 700;
}
.director-plan summary span { display: inline-flex; align-items: center; gap: 7px; }
.director-plan summary small { color: var(--muted); font-size: 11px; font-weight: 500; }
.director-plan-actions { padding: 0 14px 10px; display: flex; justify-content: flex-end; }
.director-plan .global-prompt { margin: 0 14px 14px; }
.global-prompt {
  padding: 14px; border-radius: 12px; border: 1px solid rgba(59,130,246,0.25);
  background: rgba(59,130,246,0.08); margin-bottom: 14px;
}
.global-prompt span { display: block; color: #93c5fd; font-size: 12px; font-weight: 700; margin-bottom: 6px; }
.global-prompt p {
  max-height: 300px; overflow-y: auto; white-space: pre-wrap;
  color: #dbeafe; font-size: 13px; line-height: 1.7;
  padding-right: 8px;
}
.shot-list { display: grid; gap: 14px; }
.shot-timeline {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px; padding: 6px 0 14px;
}
.shot-timeline.story-only {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.shot-timeline.story-only .timeline-shot {
  min-height: 0;
  border-radius: 7px;
  background: rgba(255,255,255,.025);
}
.shot-timeline.story-only .timeline-shot:last-child { display: none; }
.shot-timeline.story-only .timeline-meta { align-content: start; min-height: 0; padding: 15px; }
.shot-timeline.story-only .timeline-meta strong { min-height: 0; font-size: 14px; }
.story-save-note {
  display: flex; align-items: center; gap: 7px; margin-bottom: 4px;
  color: #8e979f; font-size: 10px;
}
.story-save-note i { color: #00c288; }
.story-text-editor { display: grid; gap: 11px; }
.story-text-editor label { display: grid; gap: 5px; }
.story-text-editor label > span {
  display: flex; justify-content: space-between; gap: 12px;
  color: #8e979f; font-size: 9px; font-weight: 700;
}
.story-text-editor label > span em { color: #737c85; font-style: normal; font-weight: 500; }
.story-text-editor input,
.story-text-editor textarea {
  width: 100%; border: 1px solid rgba(255,255,255,.11); border-radius: 5px;
  background: #0a0c0f; color: #dce1e5; padding: 8px 9px; font: inherit; font-size: 11px; line-height: 1.55;
}
.story-text-editor textarea { resize: vertical; min-height: 78px; }
.story-text-editor input:focus,
.story-text-editor textarea:focus { outline: 1px solid rgba(0,194,136,.55); border-color: rgba(0,194,136,.55); }
.story-text-editor.is-warning label:last-child span em { color: #fbbf24; }
.story-text-editor.is-error label:last-child span em { color: #fca5a5; }
.shot-timeline::-webkit-scrollbar { height: 8px; }
.shot-timeline::-webkit-scrollbar-thumb { background: rgba(147,197,253,0.28); border-radius: 999px; }
.timeline-shot {
  position: relative; scroll-snap-align: start; border: 1px solid var(--border);
  border-radius: 14px; background: rgba(255,255,255,0.04); overflow: hidden;
}
.timeline-shot::after {
  content: ""; position: absolute; top: 82px; right: -12px; width: 12px; height: 2px;
  background: rgba(147,197,253,0.35);
}
.timeline-shot:last-child::after { display: none; }
.timeline-thumb { position: relative; height: 132px; background: #111; overflow: hidden; }
.timeline-thumb img,
.timeline-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot-image-stack {
  position: relative; width: 100%; height: 100%; border: 0; padding: 0; overflow: hidden;
  background: #0a0d11; cursor: zoom-in;
}
.shot-image-stack img {
  position: absolute; inset: 8px; width: calc(100% - 16px); height: calc(100% - 16px);
  border: 1px solid rgba(255,255,255,.22); border-radius: 4px; object-fit: cover;
  transform: translate(calc((var(--stack-index) - 1) * 6px), calc((var(--stack-index) - 1) * -3px)) rotate(calc((var(--stack-index) - 1) * 1.4deg));
  box-shadow: 0 8px 18px rgba(0,0,0,.32);
}
.shot-image-stack em {
  position: absolute; right: 10px; bottom: 10px; z-index: 5; display: inline-flex; gap: 5px; align-items: center;
  padding: 5px 7px; border-radius: 4px; background: rgba(0,0,0,.72); color: #fff; font-size: 10px; font-style: normal; font-weight: 700;
}
.shot-gallery-modal {
  position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 24px;
  background: rgba(3,6,10,.88); backdrop-filter: blur(14px);
}
.generation-history-modal {
  position: fixed; inset: 0; z-index: 125; display: grid; place-items: center; padding: 24px;
  background: rgba(3,6,10,.88); backdrop-filter: blur(14px);
}
.auth-modal {
  position: fixed; inset: 0; z-index: 140; display: grid; place-items: center; padding: 22px;
  background: rgba(3,6,10,.9); backdrop-filter: blur(18px);
}
.auth-dialog {
  position: relative; width: min(430px, 100%); display: grid; gap: 14px; padding: 26px;
  border: 1px solid rgba(255,255,255,.14); border-radius: 8px; background: #101419;
  box-shadow: 0 30px 90px rgba(0,0,0,.55);
}
.auth-dialog > span { color: #6ee7b7; font-size: 9px; font-weight: 800; }
.auth-dialog h2 { font-size: 22px; }
.auth-dialog > p { color: #929aa2; font-size: 11px; line-height: 1.6; }
.auth-close { position: absolute; right: 14px; top: 14px; }
.auth-form { display: grid; gap: 12px; }
.auth-form label { display: grid; gap: 6px; color: #aeb5bc; font-size: 10px; font-weight: 700; }
.auth-form input {
  width: 100%; height: 40px; padding: 0 11px; border: 1px solid rgba(255,255,255,.13);
  border-radius: 5px; background: #090b0e; color: #edf0f2; font: inherit; font-size: 12px;
}
.auth-form input:focus { outline: 1px solid rgba(0,194,136,.6); border-color: rgba(0,194,136,.6); }
.auth-message { min-height: 16px; color: #fca5a5 !important; }
.auth-user-panel { display: grid; gap: 10px; }
.auth-user-summary {
  display: grid; gap: 4px; padding: 12px; border: 1px solid rgba(255,255,255,.1);
  border-radius: 5px; background: rgba(255,255,255,.025);
}
.auth-user-summary strong { font-size: 12px; }
.auth-user-summary span { color: #8e979f; font-size: 10px; }
.quota-row { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; }
.quota-row span { padding: 8px; border: 1px solid rgba(255,255,255,.08); border-radius: 4px; color: #aeb5bc; font-size: 9px; }
.generation-history-dialog {
  width: min(760px, 100%); max-height: calc(100vh - 48px); display: grid; grid-template-rows: auto minmax(0,1fr);
  overflow: hidden; border: 1px solid rgba(255,255,255,.14); border-radius: 8px; background: #101419;
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
}
.generation-history-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 18px;
  padding: 18px; border-bottom: 1px solid var(--border);
}
.generation-history-head div { display: grid; gap: 3px; }
.generation-history-head span { color: #6ee7b7; font-size: 9px; font-weight: 800; }
.generation-history-head h2 { font-size: 18px; }
.generation-history-head p { color: #818991; font-size: 10px; }
.generation-history-list { overflow: auto; padding: 8px 18px 18px; }
.history-empty { display: grid; place-items: center; gap: 8px; min-height: 220px; color: #818991; font-size: 11px; text-align: center; }
.history-empty i { color: #4b5563; font-size: 24px; }
.history-record {
  display: grid; grid-template-columns: 24px minmax(0,1fr) max-content; gap: 11px; align-items: start;
  padding: 13px 0; border-bottom: 1px solid rgba(255,255,255,.08);
}
.history-record:last-child { border-bottom: 0; }
.history-record > i { margin-top: 2px; color: #6ee7b7; }
.history-record.is-failed > i { color: #fca5a5; }
.history-record-copy { min-width: 0; display: grid; gap: 4px; }
.history-record-copy strong { font-size: 12px; }
.history-record-copy span { color: #818991; font-size: 9px; }
.history-record-copy code { overflow: hidden; color: #626b74; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.history-record-copy p { color: #fca5a5; font-size: 10px; line-height: 1.5; }
.history-record-actions { display: flex; gap: 5px; }
.history-record-actions a {
  padding: 5px 7px; border: 1px solid rgba(255,255,255,.12); border-radius: 4px;
  color: #cdd3d8; font-size: 9px; text-decoration: none;
}
.shot-gallery-dialog {
  width: min(1180px, 100%); max-height: calc(100vh - 48px); overflow: auto; border: 1px solid rgba(255,255,255,.15);
  border-radius: 8px; background: #101419; box-shadow: 0 30px 80px rgba(0,0,0,.5);
}
.shot-gallery-head {
  position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 16px 18px; border-bottom: 1px solid var(--border); background: rgba(16,20,25,.96);
}
.shot-gallery-head div { display: grid; gap: 3px; }
.shot-gallery-head span { color: #6ee7b7; font-size: 10px; font-weight: 800; }
.shot-gallery-head h2 { font-size: 18px; }
.shot-gallery-grid { display: grid; gap: 14px; padding: 18px; }
.shot-gallery-grid figure { display: grid; gap: 7px; margin: 0; }
.shot-gallery-grid img { width: 100%; border-radius: 5px; border: 1px solid var(--border); background: #080a0d; }
.shot-gallery-grid figcaption { color: var(--muted); font-size: 11px; }
.shot-awaiting-image {
  width: 100%; height: 100%; display: grid; place-content: center; justify-items: center; gap: 8px;
  color: #9ca3af; background: rgba(255,255,255,0.025); font-size: 11px;
}
.shot-awaiting-image i { font-size: 22px; color: #64748b; }
.shot-awaiting-image.generating { color: #fde68a; background: rgba(245,158,11,0.05); }
.shot-awaiting-image.generating i { color: #fbbf24; }
.timeline-thumb span {
  position: absolute; left: 10px; top: 10px; padding: 4px 8px; border-radius: 999px;
  background: rgba(0,0,0,0.62); color: #fff; font-size: 12px; font-weight: 700;
}
.shot-status {
  position: absolute; right: 9px; top: 9px; z-index: 2; display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 7px; border-radius: 999px; background: rgba(0,0,0,0.68); color: #d1d5db; font-size: 10px; font-weight: 800;
}
.shot-status.ready { color: #6ee7b7; }
.shot-status.generating { color: #fde68a; }
.shot-status.error { color: #fca5a5; }
.shot-status.generating i { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.timeline-meta { padding: 12px; display: grid; gap: 10px; }
.timeline-meta strong { font-size: 15px; line-height: 1.35; min-height: 40px; }
.timeline-shot.is-reviewing .timeline-meta { min-height: 66px; align-content: center; }
.timeline-shot.is-editing { grid-column: span 3; display: grid; grid-template-columns: minmax(260px, 36%) minmax(0, 1fr); }
.timeline-shot.is-editing .timeline-thumb { height: 100%; min-height: 260px; }

@media (max-width: 760px) {
  .shot-timeline.story-only { grid-template-columns: 1fr; }
  .timeline-shot.is-editing { grid-column: auto; display: block; }
  .timeline-shot.is-editing .timeline-thumb { min-height: 190px; height: 190px; }
}

/* Stable storyboard review/edit layouts. Keep these last to override legacy responsive rules. */
.shot-timeline.is-editing {
  grid-template-columns: minmax(0, 1fr);
}
.shot-timeline.is-editing .timeline-shot,
.shot-timeline.is-editing .timeline-shot:last-child {
  grid-column: auto;
  display: grid;
  grid-template-columns: minmax(280px, 36%) minmax(0, 1fr);
  align-items: stretch;
}
.shot-timeline.is-editing .timeline-thumb,
.shot-timeline.is-editing .timeline-shot:last-child .timeline-thumb {
  height: 100%;
  min-height: 280px;
  aspect-ratio: auto;
}
.workflow-actions.is-reviewing {
  grid-template-columns: minmax(0, 1fr) repeat(2, minmax(170px, 230px));
}
.workflow-actions.is-reviewing #generateShotsBtn[hidden],
.workflow-actions.is-reviewing #createVideoBtn[hidden],
.workflow-actions.is-reviewing #editStoryboardBtn[hidden] {
  display: none;
}
.workflow-actions.is-editing {
  grid-template-columns: minmax(0, 1fr) minmax(170px, 230px);
}
.workflow-actions.is-editing #createVideoBtn,
.workflow-actions.is-editing #generateShotsBtn {
  display: none;
}
.multi-image-upload {
  min-height: 32px; display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px;
  border: 1px solid rgba(147,197,253,.3); border-radius: 5px; color: #93c5fd;
  background: rgba(59,130,246,.06); font-size: 11px; font-weight: 700; cursor: pointer;
}
.multi-image-upload input { display: none; }

@media (max-width: 760px) {
  .shot-timeline.is-editing .timeline-shot,
  .shot-timeline.is-editing .timeline-shot:last-child {
    display: block;
  }
  .shot-timeline.is-editing .timeline-thumb,
  .shot-timeline.is-editing .timeline-shot:last-child .timeline-thumb {
    height: auto;
    min-height: 0;
    aspect-ratio: 16 / 9;
  }
  .workflow-actions.is-reviewing,
  .workflow-actions.is-editing {
    grid-template-columns: 1fr;
  }
}
.shot-connection {
  display: grid; grid-template-columns: auto minmax(0,1fr); gap: 7px; align-items: start;
  padding-top: 9px; border-top: 1px solid var(--border); color: #a7f3d0; font-size: 11px; line-height: 1.55;
}
.shot-connection i { margin-top: 3px; }
.shot-connection span { display: grid; gap: 2px; }
.shot-connection b { color: #6ee7b7; font-size: 10px; }
.timeline-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.timeline-actions button,
.timeline-actions label {
  min-height: 36px; display: flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border); border-radius: 9px; background: rgba(255,255,255,0.06);
  color: var(--text); font-size: 12px; font-weight: 700; cursor: pointer;
}
.timeline-actions label { color: #93c5fd; border-color: rgba(147,197,253,0.28); }
.timeline-actions input { display: none; }
.timeline-actions button:hover,
.timeline-actions label:hover { border-color: rgba(147,197,253,0.55); color: #bfdbfe; }
.timeline-actions .generate-shot { color: #6ee7b7; border-color: rgba(0,194,136,0.3); }
.timeline-actions .open-aesthetic { color: #c4b5fd; border-color: rgba(167,139,250,0.32); }
.timeline-actions button:disabled { cursor: wait; opacity: 0.55; }
.shot-description-editor {
  display: grid; gap: 8px; padding: 10px; border: 1px solid rgba(0,194,136,.26);
  border-radius: 6px; background: rgba(0,194,136,.045);
}
.shot-description-editor label { color: #79e8c4; font-size: 11px; font-weight: 700; }
.shot-description-editor textarea {
  width: 100%; resize: vertical; border: 1px solid var(--border); border-radius: 5px; padding: 9px 10px;
  background: #090c10; color: var(--text); font: inherit; font-size: 12px; line-height: 1.6;
}
.shot-description-editor > div { display: flex; justify-content: flex-end; gap: 6px; flex-wrap: wrap; }
.shot-description-editor button {
  min-height: 32px; border: 1px solid var(--border); border-radius: 5px; padding: 6px 9px;
  background: rgba(255,255,255,.05); color: var(--text); font-size: 11px; cursor: pointer;
}
.shot-description-editor button.primary { border-color: rgba(0,194,136,.45); background: #00c288; color: #03120d; font-weight: 800; }
.shot-aesthetics { display: flex; flex-wrap: wrap; gap: 5px; }
.shot-aesthetic-tag {
  display: inline-flex; align-items: center; gap: 5px; min-width: 0; padding: 4px 7px;
  border: 1px solid rgba(167,139,250,0.25); border-radius: 7px; background: rgba(124,58,237,0.1);
  color: #ddd6fe; font-size: 11px; line-height: 1.3;
}
.shot-aesthetic-tag button {
  border: 0; padding: 0; background: transparent; color: #a78bfa; cursor: pointer; font-size: 11px;
}
.prompt-edit-panel {
  border: 1px solid var(--border); border-radius: 14px; background: rgba(0,0,0,0.14);
  padding: 14px; display: grid; gap: 12px;
}
.prompt-edit-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.prompt-edit-head div { display: grid; gap: 4px; }
.prompt-edit-head strong { font-size: 16px; }
.prompt-edit-head span { color: var(--muted); font-size: 13px; }
.prompt-edit-head button {
  border: 1px solid var(--border); background: rgba(255,255,255,0.06); color: var(--text);
  border-radius: 8px; padding: 7px 10px; cursor: pointer;
}
.prompt-edit-panel textarea {
  width: 100%; min-height: 92px; resize: vertical; border: 1px solid var(--border);
  border-radius: 10px; background: rgba(255,255,255,0.035); color: #dbeafe;
  padding: 10px; font: 12px/1.6 ui-monospace, monospace;
}
.prompt-edit-panel textarea:focus { outline: none; border-color: rgba(147,197,253,0.65); box-shadow: 0 0 0 2px rgba(59,130,246,0.16); }
.shot-card {
  display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 14px;
  padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: rgba(255,255,255,0.035);
}
.shot-thumb { position: relative; min-height: 128px; border-radius: 10px; overflow: hidden; background: #111; }
.shot-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.brand-outro-thumb {
  display: grid; place-items: center; background: #00C288;
}
.brand-outro-thumb img {
  width: 38%; height: auto; max-height: 42%; object-fit: contain; opacity: 0.96;
}
.shot-thumb span {
  position: absolute; left: 10px; top: 10px; padding: 4px 8px; border-radius: 999px;
  background: rgba(0,0,0,0.62); color: #fff; font-size: 12px; font-weight: 700;
}
@keyframes motionPoster {
  from { transform: scale(1.02) translate3d(-1%, -1%, 0); }
  to { transform: scale(1.1) translate3d(1.5%, 1%, 0); }
}
.shot-content { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.shot-title-row { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.shot-title-row h3 { font-size: 16px; }
.shot-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.shot-upload { display: flex; align-items: center; gap: 5px; }
.shot-upload input { display: none; }
.shot-content p { color: var(--muted); font-size: 13px; line-height: 1.55; }
.shot-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.shot-tags span {
  border: 1px solid var(--border); background: rgba(0,0,0,0.18); color: #d1d5db;
  border-radius: 8px; padding: 5px 8px; font-size: 12px; display: flex; align-items: center; gap: 5px;
}
.shot-content details {
  border: 1px solid var(--border); border-radius: 10px; background: rgba(0,0,0,0.16);
}
.shot-content summary { cursor: pointer; padding: 9px 10px; color: #93c5fd; font-size: 12px; font-weight: 700; }
.shot-prompt { padding: 0 10px 10px; color: #bfdbfe; font-family: ui-monospace, monospace; font-size: 12px; line-height: 1.6; }
.library-view { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; }
.aesthetic-apply-context {
  display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 16px;
  border: 1px solid rgba(167,139,250,0.32); border-radius: 14px;
  background: linear-gradient(110deg, rgba(76,29,149,0.2), rgba(30,64,175,0.12));
}
.aesthetic-context-copy { min-width: 0; display: grid; gap: 3px; }
.aesthetic-context-copy span { color: #c4b5fd; font-size: 11px; font-weight: 700; }
.aesthetic-context-copy strong { font-size: 15px; }
.aesthetic-context-copy p { color: var(--muted); font-size: 12px; line-height: 1.5; }
.aesthetic-context-actions { display: flex; gap: 8px; flex-shrink: 0; }
.aesthetic-context-actions .btn { padding: 9px 12px; font-size: 12px; white-space: nowrap; }
.suffix-bar {
  padding: 10px 16px; background: rgba(220,38,38,0.08); border: 1px solid rgba(220,38,38,0.25);
  border-radius: 12px; font-size: 12px; color: #fca5a5; display: none;
}
.suffix-bar.visible { display: block; }
.suffix-bar button { margin-left: 8px; padding: 4px 10px; border-radius: 6px; border: none; background: var(--cn); color: #fff; cursor: pointer; font-size: 11px; }
.main { display: flex; flex: 1; gap: 12px; min-height: 0; }
.sidebar {
  width: 220px; flex-shrink: 0; background: var(--panel); border: 1px solid var(--border);
  border-radius: 16px; padding: 12px; overflow-y: auto;
}
.cat-btn {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 10px 12px; margin-bottom: 4px; border: none; border-radius: 10px;
  background: transparent; color: var(--muted); font-size: 13px; cursor: pointer; text-align: left;
}
.cat-btn:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.cat-btn.active { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; }
.cat-btn.active.cn { background: linear-gradient(135deg, var(--cn), var(--cn2)); }
.cat-btn .count { margin-left: auto; font-size: 11px; opacity: 0.85; }
.center {
  flex: 1; display: flex; flex-direction: column; min-width: 0;
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px; overflow: hidden;
}
.toolbar {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.view-toggle button {
  padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: transparent; color: var(--muted); cursor: pointer; font-size: 12px;
}
.view-toggle button.active { background: rgba(59,130,246,0.2); color: #93c5fd; }
.view-toggle.hidden { display: none !important; }
.table-only-hint { font-size: 12px; color: var(--muted); margin-left: auto; }
.cards-wrap { flex: 1; overflow-y: auto; padding: 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.card {
  background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: 12px;
  overflow: hidden; cursor: pointer; transition: 0.2s;
}
.card:hover { border-color: rgba(59,130,246,0.4); }
.card.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.library-view.is-applying .card { position: relative; }
.library-view.is-applying .card::after {
  content: '点击应用'; position: absolute; right: 9px; top: 9px; padding: 4px 7px; border-radius: 7px;
  background: rgba(15,23,42,0.82); border: 1px solid rgba(196,181,253,0.3);
  color: #ddd6fe; font-size: 10px; font-weight: 700; opacity: 0; transition: opacity 0.18s;
}
.library-view.is-applying .card:hover::after { opacity: 1; }
.card-img { height: 120px; background: #111; position: relative; overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-img .no-img {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; color: var(--muted); font-size: 11px; gap: 4px; padding: 8px; text-align: center;
}
.card-body { padding: 12px; }
.card-body h3 { font-size: 15px; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-body p { font-size: 12px; color: var(--muted); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-kw { margin-top: 8px; font-size: 11px; color: #60a5fa; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pill { font-size: 10px; padding: 2px 6px; border-radius: 4px; font-weight: 600; }
.pill.shared { background: rgba(16,185,129,0.2); color: #34d399; }
.pill.pending { background: rgba(245,158,11,0.2); color: #fbbf24; }
.pill.online { background: rgba(59,130,246,0.2); color: #93c5fd; }
.table-wrap { flex: 1; overflow: auto; padding: 0 16px 16px; display: none; }
table { width: 100%; border-collapse: separate; border-spacing: 0 6px; font-size: 13px; }
th { position: sticky; top: 0; background: rgba(11,15,25,0.98); padding: 10px 12px; text-align: left; color: var(--muted); font-size: 11px; z-index: 5; }
tr.data-row { cursor: pointer; }
tr.data-row td { padding: 12px; background: rgba(255,255,255,0.02); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
tr.data-row:hover td { background: rgba(59,130,246,0.08); }
tr.data-row.selected td { background: rgba(59,130,246,0.15); }
tr.data-row td:first-child { border-left: 1px solid var(--border); border-radius: 8px 0 0 8px; font-weight: 600; }
tr.data-row td:last-child { border-right: 1px solid var(--border); border-radius: 0 8px 8px 0; }
.badge { font-size: 10px; padding: 2px 8px; border-radius: 4px; font-weight: 600; }
.badge.basic { background: rgba(16,185,129,0.2); color: #34d399; }
.badge.medium { background: rgba(245,158,11,0.2); color: #fbbf24; }
.badge.advanced { background: rgba(239,68,68,0.2); color: #f87171; }
.detail {
  width: 400px; flex-shrink: 0; background: var(--panel); border: 1px solid var(--border);
  border-radius: 16px; display: flex; flex-direction: column; overflow: hidden;
}
.detail.no-preview .detail-img { display: none; }
.detail-img { height: 200px; background: #000; position: relative; }
.detail-img img { width: 100%; height: 100%; object-fit: cover; }
.detail-img .placeholder { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); gap: 8px; font-size: 13px; padding: 12px; text-align: center; }
.detail-body { padding: 20px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.detail-body h2 { font-size: 22px; }
.meta { font-size: 13px; color: var(--muted); line-height: 1.6; }
.meta span { color: #60a5fa; }
.box { background: rgba(0,0,0,0.2); border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.box-title { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.box-text { font-size: 13px; line-height: 1.6; }
.prompt-box .box-text { color: #93c5fd; font-family: ui-monospace, monospace; font-size: 12px; }
.actions { display: flex; flex-direction: column; gap: 8px; margin-top: auto; padding-top: 8px; }
.library-view.is-applying .detail,
.library-view.is-applying .view-toggle,
.library-view.is-applying .table-only-hint { display: none !important; }
.library-view.is-applying .center { border-color: rgba(167,139,250,0.2); }
.library-view.is-applying .toolbar::after {
  content: '点击喜欢的参考，系统自动写入提示词'; margin-left: auto; color: #c4b5fd; font-size: 12px;
}
.btn {
  padding: 12px; border-radius: 10px; border: none; font-weight: 600; font-size: 14px;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; }
.btn-apply-aesthetic { background: linear-gradient(135deg, #7c3aed, #4f46e5); color: #fff; }
.btn-apply-aesthetic:disabled { opacity: 0.48; cursor: not-allowed; }
.btn-secondary { background: rgba(255,255,255,0.06); color: var(--text); border: 1px solid var(--border); }
.composer {
  margin-top: 8px; padding: 12px; background: rgba(59,130,246,0.08);
  border: 1px dashed rgba(59,130,246,0.3); border-radius: 10px;
}
.composer h4 { font-size: 12px; color: #93c5fd; margin-bottom: 8px; }
.composer-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; min-height: 24px; }
.tag { font-size: 11px; padding: 4px 8px; background: rgba(59,130,246,0.2); border-radius: 6px; display: flex; align-items: center; gap: 6px; }
.tag button { background: none; border: none; color: var(--muted); cursor: pointer; }
.composer-output { font-size: 12px; color: var(--muted); line-height: 1.5; max-height: 80px; overflow-y: auto; }
.toast {
  position: fixed; top: 20px; right: 20px; background: var(--success); color: #fff;
  padding: 12px 20px; border-radius: 8px; font-size: 14px; z-index: 999; display: none;
}
.manual-copy-panel {
  position: fixed; right: 20px; bottom: 20px; width: min(520px, calc(100vw - 40px));
  max-height: calc(100vh - 40px); overflow: auto;
  padding: 16px; border: 1px solid rgba(147,197,253,0.35); border-radius: 14px;
  background: #111827; box-shadow: 0 24px 90px rgba(0,0,0,0.45); z-index: 1000;
  display: none;
}
.manual-copy-panel.visible { display: block; }
.manual-copy-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.manual-copy-head strong { font-size: 15px; }
.manual-copy-head button {
  border: 1px solid var(--border); background: rgba(255,255,255,0.06); color: var(--text);
  border-radius: 8px; padding: 6px 10px; cursor: pointer;
}
.manual-copy-panel p { color: var(--muted); font-size: 13px; line-height: 1.5; margin-bottom: 10px; }
.manual-copy-panel textarea {
  width: 100%; min-height: 180px; max-height: min(44vh, 420px); resize: vertical; border: 1px solid var(--border);
  border-radius: 10px; background: rgba(0,0,0,0.28); color: var(--text);
  padding: 10px; font: 12px/1.55 ui-monospace, monospace;
}
.empty { text-align: center; padding: 60px 20px; color: var(--muted); grid-column: 1 / -1; }
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-chips button {
  padding: 4px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: transparent; color: var(--muted); font-size: 11px; cursor: pointer;
}
.filter-chips button.active { background: rgba(245,158,11,0.15); color: #fbbf24; border-color: rgba(245,158,11,0.4); }
@media (max-width: 1100px) {
  .creator-start { min-height: 0; padding: 24px 18px 30px; }
  .workflow-actions { justify-content: flex-start; }
  .shot-card { grid-template-columns: 1fr; }
  .main { flex-direction: column; }
  .sidebar { width: 100%; display: flex; flex-wrap: wrap; }
  .cat-btn { width: auto; flex: 1; min-width: 120px; }
  .detail { width: 100%; max-height: 50vh; }
  .template-shot-preview { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .workflow-head { flex-direction: column; }
  .workflow-actions { grid-template-columns: 1fr; }
  .template-video-panel { grid-template-columns: 1fr; }
  .character-picker { grid-template-columns: 1fr; }
  .aesthetic-apply-context { align-items: flex-start; flex-direction: column; }
  .template-adapt-panel { grid-template-columns: 1fr; gap: 16px; }
  .generated-video-result { grid-template-columns: 1fr; }
  .shot-timeline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .app { height: auto; min-height: 100vh; padding: 10px; }
  header { padding: 12px; }
  .workspace-context { order: 3; width: 100%; padding: 10px 0 0; border-left: 0; border-top: 1px solid var(--border); }
  .resource-button { margin-left: auto; }
  .start-copy h2 { font-size: 30px; }
  .creator-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .creator-steps span + span::after { display: none; }
  .auto-options { grid-template-columns: 1fr; }
  .template-picker {
    grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(230px, 82vw);
    overflow-x: auto; overscroll-behavior-inline: contain; scroll-snap-type: inline mandatory;
    will-change: scroll-position;
  }
  .shot-title-row { align-items: flex-start; flex-direction: column; }
  .workflow-actions .btn { min-width: 0; }
  .character-section-head { flex-direction: column; }
  .character-option { grid-template-columns: 68px minmax(0, 1fr) auto; }
  .character-option img { width: 68px; height: 80px; }
  .template-adapt-actions { grid-template-columns: 1fr; }
  .template-shot-preview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shot-timeline { grid-template-columns: 1fr; }
}

/* Taste-led workflow: one continuous path from reference to generation. */
.workflow-card {
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: 36px 0 72px;
  background: transparent;
  border: 0;
  border-radius: 0;
  backdrop-filter: none;
}
.workflow-head {
  margin: 0 0 28px;
  align-items: end;
}
.workflow-head > div {
  display: grid;
  gap: 8px;
}
.back-to-templates {
  width: fit-content;
  margin: 0 0 18px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #a8adb4;
}
.back-to-templates:hover {
  color: #fff;
  border-color: transparent;
}
.workflow-head .eyebrow {
  margin: 0;
  color: #69e4bd;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
}
.workflow-head h2 {
  max-width: 860px;
  font-size: clamp(32px, 4vw, 52px);
  line-height: 1.08;
  font-weight: 600;
}
.template-video-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, .65fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: center;
  margin: 0 0 72px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.template-video-media {
  max-height: none;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 6px;
  box-shadow: 0 30px 80px rgba(0,0,0,.38);
}
.template-video-copy {
  gap: 14px;
}
.template-video-copy span {
  color: #69e4bd;
  font-size: 11px;
  letter-spacing: 0;
}
.template-video-copy h3 {
  max-width: 420px;
  font-size: clamp(26px, 3vw, 38px);
  line-height: 1.15;
  font-weight: 600;
}
.template-video-copy p {
  max-width: 430px;
  color: #b2b6bc;
  font-size: 14px;
  line-height: 1.8;
}
.template-adapt-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(220px, .68fr) minmax(420px, 1.32fr);
  gap: clamp(32px, 7vw, 96px);
  align-items: center;
  margin: 0 0 88px;
  padding: 42px 0;
  border-top: 1px solid rgba(255,255,255,.12);
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.template-adapt-copy {
  gap: 10px;
}
.template-adapt-copy span,
.template-structure-head span {
  color: #69e4bd;
  font-size: 11px;
  letter-spacing: 0;
}
.template-adapt-copy h3,
.template-structure-head h3 {
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.18;
  font-weight: 600;
}
.template-adapt-copy p {
  color: #a8adb4;
  font-size: 14px;
  line-height: 1.75;
}
.template-adapt-form {
  gap: 12px;
}
.template-adapt-form textarea {
  min-height: 148px;
  padding: 18px;
  border-color: rgba(255,255,255,.14);
  border-radius: 6px;
  background: #0d1014;
  font-size: 16px;
  line-height: 1.7;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.template-adapt-form textarea:focus {
  border-color: rgba(0,194,136,.8);
  box-shadow: 0 0 0 3px rgba(0,194,136,.12);
}
.template-adapt-actions {
  grid-template-columns: auto minmax(0,1fr) minmax(220px, auto);
}
.reference-upload {
  min-height: 50px;
  border-radius: 6px;
  color: #d5d8dc;
  background: transparent;
}
.template-adapt-actions .btn {
  min-height: 50px;
  border-radius: 6px;
  font-size: 14px;
}
.adaptation-inline-editor {
  grid-column: 1 / -1;
  display: grid;
  gap: 9px;
  width: 100%;
  padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,.1);
}
.adaptation-inline-editor label {
  color: #9ba3ab;
  font-size: 10px;
  font-weight: 600;
}
.adaptation-inline-editor textarea {
  width: 100%;
  min-height: 92px;
  padding: 13px 14px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 6px;
  background: #0b0e11;
  color: #eef1f3;
  font: inherit;
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
}
.adaptation-inline-editor textarea:focus {
  outline: none;
  border-color: rgba(0,194,136,.72);
}
.adaptation-inline-editor > div {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.btn-primary {
  background: #00c288;
  color: #03120d;
  box-shadow: none;
}
.btn-primary:hover {
  background: #13d69b;
}
.template-structure {
  gap: 24px;
  padding: 0 0 64px;
}
.template-structure-head {
  max-width: 700px;
  gap: 8px;
}
.template-shot-preview {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 32px 16px;
}
.template-preview-shot {
  gap: 10px;
}
.template-preview-media {
  aspect-ratio: 16 / 9;
  border-radius: 5px;
  border: 1px solid rgba(255,255,255,.09);
}
.template-preview-media img,
.template-preview-media video {
  transition: transform .65s cubic-bezier(.2,.75,.25,1), filter .4s ease;
}
.template-preview-shot:hover .template-preview-media img,
.template-preview-shot:hover .template-preview-media video {
  transform: scale(1.035);
  filter: saturate(1.08);
}
.template-preview-media span {
  left: 10px;
  top: 10px;
  padding: 4px 7px;
  border-radius: 4px;
  background: rgba(4,6,8,.72);
  font-size: 10px;
}
.template-preview-shot strong {
  font-size: 15px;
  line-height: 1.45;
}
.template-preview-shot p {
  max-width: 94%;
  color: #969ba3;
  font-size: 12px;
  line-height: 1.65;
}
.adaptation-result,
.generation-status {
  border: 0;
  border-left: 3px solid #00c288;
  border-radius: 0;
  background: rgba(0,194,136,.055);
}
.adaptation-result {
  margin: 0 0 26px;
  padding: 18px 20px;
}
.generation-status {
  margin: 0 0 18px;
  padding: 18px 20px;
}
.shot-timeline {
  gap: 16px;
  padding: 8px 0 26px;
}
.timeline-shot {
  border-radius: 6px;
  background: #0e1115;
}
.timeline-shot::after {
  display: none;
}
.timeline-thumb {
  height: auto;
  aspect-ratio: 16 / 9;
}
.timeline-meta {
  padding: 14px;
}
.timeline-meta strong {
  min-height: 0;
}
.timeline-shot:last-child {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(220px, .7fr) minmax(0, 1.3fr);
  align-items: stretch;
  border-color: rgba(0,194,136,.28);
}
.timeline-shot:last-child .timeline-thumb {
  height: 100%;
  min-height: 168px;
  aspect-ratio: auto;
}
.workflow-actions {
  bottom: 16px;
  grid-template-columns: minmax(0,1fr) repeat(2, minmax(170px, 230px));
  margin: 20px 0 28px;
  padding: 12px 12px 12px 18px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 7px;
  background: rgba(17,20,24,.94);
  box-shadow: 0 22px 60px rgba(0,0,0,.42);
}
.workflow-actions .btn {
  min-height: 56px;
  border-radius: 5px;
  box-shadow: none;
}
.next-action-copy {
  gap: 5px;
}
.next-action-copy span {
  color: #69e4bd;
  letter-spacing: 0;
}
.next-action-copy strong {
  font-size: 15px;
}
.generated-video-result {
  border-radius: 6px;
  background: #0e1214;
}
.resource-button,
.header-actions a,
.header-actions button {
  border-radius: 5px;
}

/* Home: choose a finished visual result, not a configuration card. */
.creator-start {
  min-height: calc(100vh - 82px);
  justify-content: center;
  gap: 44px;
  padding: 54px 24px 76px;
}
.creator-start::before {
  display: none;
}
.start-copy {
  width: min(1160px, 100%);
}
.start-copy .eyebrow {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #69e4bd;
  letter-spacing: 0;
}
.start-copy h2 {
  margin: 14px auto 12px;
  max-width: 980px;
  font-size: clamp(44px, 6vw, 76px);
  font-weight: 600;
}
.start-copy > p:not(.eyebrow) {
  color: #aeb2b8;
  font-size: 16px;
}
.template-section {
  width: min(1180px, 100%);
}
.template-picker {
  gap: 18px;
  padding: 0;
}
.template-card {
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
  transition: transform .35s cubic-bezier(.2,.75,.25,1);
}
.template-card::after {
  display: none;
}
.template-card:hover,
.template-card.active {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  transform: translateY(-5px);
}
.template-cover {
  height: auto;
  aspect-ratio: 16 / 10;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  box-shadow: 0 20px 55px rgba(0,0,0,.28);
}
.template-card.active .template-cover {
  border-color: rgba(0,194,136,.75);
  box-shadow: 0 0 0 1px rgba(0,194,136,.2), 0 24px 60px rgba(0,0,0,.35);
}
.template-info {
  gap: 7px;
  padding: 14px 0 0;
}
.template-card strong {
  font-size: 19px;
  font-weight: 600;
}
.template-card small {
  color: #969ba3;
  font-size: 13px;
}
.template-card em {
  margin-top: 4px;
  color: #69e4bd;
  font-size: 12px;
}

/* Aesthetic library: dense, calm, and directly usable. */
.library-view {
  gap: 0;
  padding-top: 16px;
}
.library-view .main {
  gap: 0;
  min-height: calc(100vh - 104px);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.sidebar {
  width: 196px;
  padding: 16px 14px 16px 0;
  border: 0;
  border-right: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
}
.cat-btn {
  margin-bottom: 2px;
  padding: 10px 11px;
  border-radius: 5px;
}
.cat-btn.active,
.cat-btn.active.cn {
  background: rgba(0,194,136,.13);
  color: #79e8c4;
}
.center {
  border: 0;
  border-radius: 0;
  background: transparent;
}
.toolbar {
  min-height: 62px;
  padding: 12px 18px;
}
.toolbar h2 {
  font-size: 22px;
  font-weight: 600;
}
.view-toggle button {
  border-radius: 5px;
}
.view-toggle button.active {
  background: rgba(0,194,136,.12);
  color: #79e8c4;
}
.cards-wrap {
  padding: 18px;
}
.cards {
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 22px 14px;
}
.card {
  border: 0;
  border-radius: 0;
  background: transparent;
  transition: transform .25s ease;
}
.card:hover {
  border-color: transparent;
  transform: translateY(-3px);
}
.card.selected {
  border-color: transparent;
  box-shadow: none;
}
.card-img {
  height: auto;
  aspect-ratio: 16 / 8;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 5px;
}
.card.selected .card-img {
  border-color: rgba(0,194,136,.72);
  box-shadow: 0 0 0 1px rgba(0,194,136,.18);
}
.card-img img {
  transition: transform .55s cubic-bezier(.2,.75,.25,1);
}
.card:hover .card-img img {
  transform: scale(1.035);
}
.card-body {
  padding: 11px 0 0;
}
.card-body h3 {
  font-size: 15px;
  margin-bottom: 5px;
}
.card-body p {
  color: #92979f;
}
.card-kw {
  color: #77c9ad;
}
.detail {
  width: 350px;
  border: 0;
  border-left: 1px solid var(--border);
  border-radius: 0;
  background: #0b0d10;
}
.detail.is-empty {
  display: none;
}
.detail-img {
  height: 210px;
}
.detail-body {
  padding: 20px;
}
.detail-body h2 {
  font-size: 25px;
}
.box,
.composer {
  border-radius: 5px;
  background: rgba(255,255,255,.025);
}
.composer {
  border-style: solid;
  border-color: var(--border);
}
.actions .btn {
  min-height: 44px;
  border-radius: 5px;
}
.lib-tab {
  border-radius: 5px;
}
.lib-tab.active,
.lib-tab.active.cn {
  border-color: rgba(0,194,136,.4);
  background: rgba(0,194,136,.12);
  color: #79e8c4;
}
.aesthetic-apply-context {
  margin-bottom: 12px;
  border-radius: 6px;
  background: rgba(0,194,136,.07);
  border-color: rgba(0,194,136,.3);
}

@keyframes tasteReveal {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.workflow-head,
.template-video-panel,
.template-adapt-panel,
.template-structure {
  animation: tasteReveal .55s both;
}
.template-video-panel { animation-delay: .05s; }
.template-adapt-panel { animation-delay: .1s; }
.template-structure { animation-delay: .15s; }

@media (max-width: 980px) {
  .template-video-panel,
  .template-adapt-panel {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .template-video-copy {
    max-width: 680px;
  }
  .template-shot-preview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .library-view .main {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding: 10px 0;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .cat-btn {
    width: auto;
    min-width: max-content;
  }
  .detail {
    width: 100%;
    border-left: 0;
    border-top: 1px solid var(--border);
  }
  .character-library-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .app {
    padding: 0 14px 28px;
  }
  header {
    padding: 14px 0;
  }
  header .stats,
  header .header-actions {
    display: none;
  }
  .workflow-card {
    padding: 24px 0 96px;
  }
  .workflow-head {
    margin-bottom: 22px;
  }
  .workflow-head h2 {
    font-size: 32px;
  }
  .template-video-panel {
    margin-bottom: 52px;
  }
  .template-video-copy h3 {
    font-size: 27px;
  }
  .template-adapt-panel {
    margin-bottom: 58px;
    padding: 30px 0;
  }
  .template-adapt-actions,
  .workflow-actions {
    grid-template-columns: 1fr;
  }
  .template-shot-preview {
    grid-template-columns: 1fr;
    gap: 26px;
  }
  .template-preview-shot p {
    max-width: none;
  }
  .timeline-shot:last-child {
    grid-column: auto;
    display: block;
  }
  .timeline-shot:last-child .timeline-thumb {
    min-height: 0;
    aspect-ratio: 16 / 9;
  }
  .workflow-actions {
    bottom: 10px;
    padding: 12px;
  }
  .creator-start {
    min-height: calc(100vh - 74px);
    justify-content: flex-start;
    gap: 34px;
    padding: 42px 0 56px;
  }
  .start-copy h2 {
    font-size: 40px;
  }
  .template-card {
    width: 82vw;
  }
  .template-cover {
    aspect-ratio: 16 / 10;
  }
  .library-view {
    padding-top: 8px;
  }
  .cards-wrap {
    padding: 14px 0;
  }
  .cards {
    grid-template-columns: 1fr;
    gap: 26px;
  }
  .detail {
    display: flex;
  }
  .character-library-modal { padding: 0; place-items: stretch; }
  .character-library-dialog { width: 100%; max-height: 100vh; border: 0; border-radius: 0; }
  .character-library-head,
  .character-library-toolbar,
  .character-library-footer { padding-left: 14px; padding-right: 14px; }
  .character-library-toolbar,
  .character-library-footer { align-items: flex-start; flex-direction: column; }
  .character-library-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 10px; padding: 14px; }
  .character-library-footer > div { width: 100%; }
  .character-library-footer .btn { flex: 1; min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Final storyboard layout guard: review stays compact; edit mode expands vertically. */
.workflow-actions.is-reviewing {
  grid-template-columns: minmax(0, 1fr) repeat(2, minmax(170px, 230px));
}
.workflow-actions.is-editing {
  grid-template-columns: minmax(0, 1fr) minmax(170px, 230px);
}
.shot-timeline.is-editing {
  grid-template-columns: minmax(0, 1fr);
}
.shot-timeline.is-editing .timeline-shot,
.shot-timeline.is-editing .timeline-shot:last-child {
  grid-column: auto;
  display: grid;
  grid-template-columns: minmax(280px, 36%) minmax(0, 1fr);
  align-items: stretch;
}
.shot-timeline.is-editing .timeline-thumb,
.shot-timeline.is-editing .timeline-shot:last-child .timeline-thumb {
  height: 100%;
  min-height: 280px;
  aspect-ratio: auto;
}

@media (max-width: 760px) {
  .workflow-actions.is-reviewing,
  .workflow-actions.is-editing {
    grid-template-columns: 1fr;
  }
  .shot-timeline.is-editing .timeline-shot,
  .shot-timeline.is-editing .timeline-shot:last-child {
    display: block;
  }
  .shot-timeline.is-editing .timeline-thumb,
  .shot-timeline.is-editing .timeline-shot:last-child .timeline-thumb {
    height: auto;
    min-height: 0;
    aspect-ratio: 16 / 9;
  }
}

/* Taste audit: compact identity rail and progressive storyboard editing. */
.character-section {
  display: grid;
  grid-template-columns: minmax(220px, .8fr) minmax(0, 1.2fr);
  align-items: center;
  gap: 24px;
  margin: 28px 0 20px;
  padding: 16px 0;
}
.character-section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  margin: 0;
}
.character-section-head > div:first-child {
  gap: 2px;
}
.character-section-head span {
  color: #8f969f;
  font-size: 10px;
  text-transform: none;
}
.character-section-head h3 {
  font-size: 16px;
}
.character-head-actions {
  flex-wrap: nowrap;
}
.character-lock-status {
  padding: 6px 8px;
  border: 0;
  background: transparent;
  color: #8f969f;
  font-size: 11px;
}
.character-head-actions .btn {
  min-height: 34px;
  border-color: rgba(255,255,255,.16);
  background: transparent;
  color: #d3d7dc;
}
.character-picker {
  justify-content: flex-end;
  align-items: center;
  gap: 7px;
  flex-wrap: nowrap;
  min-width: 0;
  overflow-x: auto;
  padding: 3px 1px;
}
.character-avatar {
  width: auto;
  min-width: 46px;
  grid-template-columns: 34px auto;
  align-items: center;
  gap: 7px;
  padding: 4px 8px 4px 4px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 999px;
  background: rgba(255,255,255,.025);
}
.character-avatar img {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255,255,255,.3);
  box-shadow: none;
}
.character-avatar span {
  width: auto;
  max-width: 88px;
  color: #c3c8ce;
  font-size: 11px;
  text-align: left;
}
.character-avatar .generated-character-mark {
  width: 34px;
  height: 34px;
  border-color: rgba(0,194,136,.4);
  background: rgba(0,194,136,.06);
}

.shot-timeline.is-editing {
  gap: 22px;
}
.shot-timeline.is-editing .timeline-shot,
.shot-timeline.is-editing .timeline-shot:last-child {
  grid-template-columns: minmax(300px, 34%) minmax(0, 1fr);
  align-items: start;
  overflow: visible;
  border-color: rgba(255,255,255,.11);
  background: #0d1014;
}
.shot-timeline.is-editing .timeline-thumb,
.shot-timeline.is-editing .timeline-shot:last-child .timeline-thumb {
  position: sticky;
  top: 86px;
  height: auto;
  min-height: 0;
  aspect-ratio: 16 / 10;
  border-right: 1px solid rgba(255,255,255,.09);
  background: #080a0d;
}
.shot-timeline.is-editing .timeline-meta {
  gap: 14px;
  padding: 20px 22px 22px;
}
.shot-timeline.is-editing .timeline-meta > strong {
  font-size: 19px;
  line-height: 1.35;
}
.generated-shot-facts {
  gap: 0;
  padding-bottom: 2px;
}
.generated-shot-facts span {
  gap: 4px;
  padding: 3px 14px 3px 0;
  border: 0;
  border-radius: 0;
  color: #a9afb6;
  font-size: 11px;
}
.generated-shot-facts b {
  color: #d8dce1;
}
.generated-shot-facts .shot-narration {
  margin-top: 6px;
  padding: 8px 10px;
  border-left: 2px solid rgba(0,194,136,.55);
  background: rgba(255,255,255,.025);
  color: #bfc4ca;
}
.shot-description-editor {
  gap: 10px;
  padding: 0;
  border: 0;
  background: transparent;
}
.shot-editor-heading {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: baseline;
}
.shot-editor-heading label {
  color: #e5e7eb;
  font-size: 12px;
}
.shot-editor-heading small {
  color: #737b84;
  font-size: 10px;
}
.shot-description-editor textarea {
  min-height: 112px;
  border-color: rgba(255,255,255,.14);
  border-radius: 6px;
  padding: 12px 13px;
  background: #090b0e;
  font-size: 12px;
  line-height: 1.75;
}
.shot-description-editor textarea:focus {
  outline: 1px solid rgba(0,194,136,.65);
  border-color: rgba(0,194,136,.65);
}
.shot-description-editor > div {
  align-items: center;
  gap: 7px;
}
.shot-description-editor button,
.multi-image-upload {
  min-height: 34px;
  padding: 7px 10px;
  border-radius: 5px;
  border-color: rgba(255,255,255,.15);
  background: transparent;
  color: #c4c9cf;
}
.multi-image-upload {
  margin-right: auto;
}
.shot-description-editor button.primary {
  border-color: #00c288;
  background: #00c288;
}
.shot-tech-details,
.shot-output-details {
  border-top: 1px solid rgba(255,255,255,.1);
}
.shot-tech-details summary,
.shot-output-details summary {
  padding-top: 12px;
  color: #9da4ac;
  font-size: 11px;
  font-weight: 600;
}
.shot-tech-details[open] summary,
.shot-output-details[open] summary {
  color: #d7dce1;
}
.shot-tech-details .generated-shot-facts {
  padding-top: 10px;
}
.shot-connection {
  grid-template-columns: 18px minmax(0, 1fr);
  padding: 11px 12px;
  border: 0;
  border-radius: 5px;
  background: rgba(255,255,255,.025);
  color: #aeb5bc;
}
.shot-connection b {
  color: #d9dde2;
}
.workflow-actions,
.workflow-actions.is-reviewing,
.workflow-actions.is-editing {
  position: sticky;
  bottom: 14px;
  z-index: 30;
  grid-template-columns: minmax(0, 1fr) repeat(2, max-content);
  align-items: center;
  gap: 8px;
  margin: 18px 0 26px;
  padding: 9px 9px 9px 14px;
  border-color: rgba(255,255,255,.13);
  border-radius: 6px;
  background: rgba(14,17,21,.9);
  box-shadow: 0 14px 40px rgba(0,0,0,.34);
  backdrop-filter: blur(16px);
}
.workflow-actions.is-editing {
  grid-template-columns: minmax(0, 1fr) max-content;
}
.next-action-copy {
  gap: 1px;
}
.next-action-copy span {
  color: #818991;
  font-size: 9px;
  font-weight: 700;
}
.next-action-copy strong {
  color: #d8dce1;
  font-size: 12px;
  font-weight: 600;
}
.workflow-actions .btn {
  width: auto;
  min-width: 0;
  min-height: 40px;
  padding: 9px 15px;
  border-radius: 5px;
  font-size: 12px;
  white-space: nowrap;
}
.workflow-actions .btn-primary {
  box-shadow: none;
}

.shot-narration-editor {
  display: grid;
  gap: 5px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.shot-narration-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.shot-narration-head label {
  color: #a5adb5;
  font-size: 10px;
  font-weight: 600;
}
.shot-narration-head span,
.shot-narration-editor small {
  color: #7f8790;
  font-size: 9px;
}
.shot-narration-editor input {
  width: 100%;
  height: 32px;
  border: 0;
  border-bottom: 1px solid rgba(255,255,255,.14);
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: #edf0f2;
  font: inherit;
  font-size: 11px;
}
.shot-narration-editor input:focus {
  outline: none;
  border-color: rgba(0,194,136,.65);
}
.shot-narration-editor.is-warning .shot-narration-head span,
.shot-narration-editor.is-warning small {
  color: #fbbf24;
}
.shot-narration-editor.is-error .shot-narration-head span,
.shot-narration-editor.is-error small {
  color: #fca5a5;
}

@media (max-width: 900px) {
  .character-section {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .character-picker {
    justify-content: flex-start;
  }
  .shot-timeline.is-editing .timeline-shot,
  .shot-timeline.is-editing .timeline-shot:last-child {
    grid-template-columns: minmax(240px, 34%) minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .character-section-head {
    grid-template-columns: 1fr;
  }
  .character-head-actions {
    justify-content: space-between;
  }
  .shot-timeline.is-editing .timeline-thumb,
  .shot-timeline.is-editing .timeline-shot:last-child .timeline-thumb {
    position: relative;
    top: auto;
    border-right: 0;
  }
  .shot-timeline.is-editing .timeline-meta {
    padding: 16px;
  }
  .shot-editor-heading {
    display: grid;
    gap: 2px;
  }
  .shot-description-editor > div {
    display: grid;
    grid-template-columns: 1fr;
  }
  .workflow-actions,
  .workflow-actions.is-reviewing,
  .workflow-actions.is-editing {
    position: relative;
    bottom: auto;
    grid-template-columns: 1fr;
    padding: 12px;
  }
  .workflow-actions .btn {
    width: 100%;
  }
  .multi-image-upload {
    margin: 0;
    justify-content: center;
  }
}
