:root {
  color-scheme: light;
  --ink: #171717;
  --muted: #6b6965;
  --line: #deddd8;
  --line-strong: #c9c7c0;
  --paper: #ffffff;
  --workspace: #f1f1ed;
  --charcoal: #252724;
  --charcoal-2: #eef0ec;
  --sidebar-text: #20231f;
  --sidebar-muted: #656a64;
  --sidebar-line: #d8dbd5;
  --red: #c83a30;
  --red-dark: #a92c25;
  --red-soft: #f8e9e7;
  --gold: #d7a229;
  --teal: #2d7c73;
  --teal-soft: #e5f1ee;
  --shadow: 0 12px 32px rgba(34, 31, 27, 0.12);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
  letter-spacing: 0;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; background: var(--workspace); color: var(--ink); }
body { overflow: hidden; }
button, input, textarea, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.5; }
svg { width: 18px; height: 18px; stroke-width: 2; flex: 0 0 auto; }

.topbar {
  height: 64px;
  display: grid;
  grid-template-columns: 280px minmax(120px, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 0 18px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { width: 38px; height: 38px; border-radius: 8px; }
.brand div { min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.brand strong { font-size: 15px; white-space: nowrap; }
.brand span { color: var(--muted); font-size: 12px; margin-top: 3px; }

.document-state { justify-self: start; display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.state-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
.document-state.saved .state-dot { background: var(--teal); }
.document-state.error .state-dot { background: var(--red); }

.top-actions { display: flex; align-items: center; gap: 8px; }
.button, .icon-button, .play-button, .subject-button, .text-command, .mini-command, .upload-command {
  border: 0;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}
.button { min-height: 38px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 6px; font-weight: 700; font-size: 13px; }
.button small { font-size: 10px; opacity: 0.72; padding-left: 2px; }
.button-primary { color: white; background: var(--red); }
.button-primary:hover { background: var(--red-dark); }
.button-secondary { color: var(--ink); background: #f5ede0; border: 1px solid #e4cfa9; }
.button-secondary:hover { background: #efe1c8; }
.button-quiet { background: #eeeeea; color: var(--ink); }
.button-quiet:hover { background: #e4e3de; }
.icon-button, .play-button { width: 36px; height: 36px; padding: 0; display: inline-grid; place-items: center; border-radius: 6px; background: transparent; color: var(--ink); }
.icon-button:hover { background: #ecebe6; }
.icon-button-light { color: #20231f; background: #e5e8e2; }
.icon-button-light:hover { background: #d9ddd6; }
.play-button { background: var(--charcoal); color: white; }
.play-button:hover { background: #000; }

.subject-button { height: 40px; display: flex; align-items: center; gap: 8px; padding: 3px 10px 3px 3px; border-radius: 6px; background: #f2f2ef; color: var(--ink); font-size: 12px; font-weight: 700; }
.subject-button:hover { background: #e9e8e3; }
.subject-thumb { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 5px; overflow: hidden; background: var(--charcoal); color: white; }
.subject-thumb img { width: 100%; height: 100%; object-fit: cover; }

.workspace { height: calc(100vh - 64px); display: grid; grid-template-columns: 280px minmax(460px, 1fr) 370px; min-width: 0; }
.baby-album-page { display: none; }
.template-panel, .inspector-panel, .stage-panel { min-width: 0; min-height: 0; }
body.manager-mode .workspace { grid-template-columns: 280px minmax(0, 1fr); }
body.manager-mode .template-panel { grid-template-rows: auto minmax(0, 1fr) auto; }
body.manager-mode .stage-panel, body.manager-mode .inspector-panel { display: none; }
body:not(.manager-mode) .manager-panel { display: none; }
body.manager-mode .editor-only, body.manager-mode #newTemplateButton, body.manager-mode #subjectUploadButton, body.manager-mode #exportButton, body.manager-mode #renderGifButton, body.manager-mode #generateButton, body.manager-mode #saveButton, body.manager-mode #managerButton { display: none !important; }
body.manager-mode .document-state { visibility: hidden; }
body.baby-album-mode .workspace { display: none; }
body.baby-album-mode .baby-album-page { display: block; }
body.baby-album-mode #babyAlbumButton, body.baby-album-mode #subjectUploadButton, body.baby-album-mode #exportButton, body.baby-album-mode #renderGifButton, body.baby-album-mode #generateButton, body.baby-album-mode #saveButton { display: none !important; }
body.baby-album-mode .document-state { visibility: hidden; }

.baby-album-page { height: calc(100vh - 64px); overflow: auto; background: #f3f4f1; }
.baby-album-heading { min-height: 116px; padding: 24px max(28px, calc((100vw - 1180px) / 2)); display: flex; align-items: center; justify-content: space-between; gap: 28px; background: white; border-bottom: 1px solid var(--line); }
.baby-album-heading h1 { margin: 5px 0; font-size: 24px; }
.baby-album-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.baby-album-specs { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.baby-album-specs span { padding: 6px 8px; border: 1px solid #d7dad4; border-radius: 4px; background: #f7f8f5; color: #555b54; font-size: 10px; font-weight: 700; }
.baby-album-content { width: min(1120px, calc(100% - 48px)); margin: 0 auto; padding: 28px 0 44px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 0.82fr); gap: 24px; align-items: start; }
.baby-album-form { min-width: 0; background: white; border: 1px solid var(--line); border-radius: 8px; }
.baby-album-section { padding: 22px; }
.baby-album-section + .baby-album-section { border-top: 1px solid var(--line); }
.baby-album-section .section-title { margin-bottom: 14px; }
.baby-album-section .section-title span { color: var(--muted); font-size: 10px; }
.baby-frame-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.baby-frame-upload { min-width: 0; padding: 10px; display: grid; grid-template-columns: 104px minmax(0, 1fr); align-items: center; gap: 12px; border: 1px dashed #b9beb6; border-radius: 6px; background: #fafbf9; cursor: pointer; }
.baby-frame-upload:hover { border-color: #9d756e; background: #fff9f7; }
.baby-frame-preview { width: 104px; aspect-ratio: 3 / 4; display: grid; place-items: center; overflow: hidden; border: 1px solid #d9dcd6; border-radius: 5px; background: #eeeeea; color: #777d75; }
.baby-frame-preview img { width: 100%; height: 100%; display: block; object-fit: cover; }
.baby-frame-upload > span:last-child { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.baby-frame-upload strong { font-size: 13px; }
.baby-frame-upload small { color: var(--muted); font-size: 10px; line-height: 1.45; }
.baby-album-help { margin: 10px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.baby-prompt-field textarea { min-height: 134px; resize: vertical; line-height: 1.6; }
.baby-form-actions { margin-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.baby-provider-state { color: #357267; font-size: 11px; font-weight: 700; }
.baby-provider-state.error { color: var(--red); }
.baby-form-actions .button:disabled { opacity: 0.45; cursor: not-allowed; }
.baby-album-result { min-height: 520px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: white; }
.baby-result-empty, .baby-result-progress, .baby-result-failure { min-height: 520px; padding: 32px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.baby-result-empty svg { width: 38px; height: 38px; margin-bottom: 14px; color: #777d75; }
.baby-result-empty strong, .baby-result-progress strong, .baby-result-failure strong { font-size: 15px; }
.baby-result-empty span, .baby-result-progress p, .baby-result-failure p { max-width: 320px; margin: 7px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.baby-result-progress { flex-direction: row; gap: 16px; text-align: left; }
.baby-result-progress > div { min-width: 0; }
.baby-result-progress small { display: block; margin-top: 9px; color: #858a84; font-size: 9px; overflow-wrap: anywhere; }
.baby-progress-icon { width: 44px; height: 44px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: #e7f1ee; color: var(--teal); }
.baby-progress-icon svg { animation: baby-spin 1.1s linear infinite; }
.baby-result-success video { width: 100%; min-height: 430px; max-height: 70vh; display: block; background: #171917; object-fit: contain; }
.baby-result-footer { min-height: 80px; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); }
.baby-result-footer > div { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.baby-result-footer strong { font-size: 13px; }
.baby-result-footer span { color: var(--muted); font-size: 10px; }
.baby-result-footer .button span { color: inherit; font-size: 12px; }
.baby-result-failure { color: var(--red); }
.baby-result-failure svg { width: 34px; height: 34px; margin-bottom: 12px; }
@keyframes baby-spin { to { transform: rotate(360deg); } }

.template-panel { background: #f7f8f5; color: var(--sidebar-text); display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; border-right: 1px solid var(--sidebar-line); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; padding: 18px 16px 12px; }
.panel-heading > div { display: flex; flex-direction: column; gap: 4px; }
.panel-heading strong { font-size: 16px; }
.eyebrow { font-size: 10px; color: var(--sidebar-muted); text-transform: uppercase; }
.search-field { margin: 0 12px 10px; height: 38px; padding: 0 10px; display: flex; align-items: center; gap: 8px; background: var(--charcoal-2); border: 1px solid var(--sidebar-line); border-radius: 6px; color: var(--sidebar-muted); }
.search-field input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--sidebar-text); font-size: 13px; }
.search-field input::placeholder { color: #858a84; }
.template-list { overflow: auto; padding: 0 8px 12px; }
.group-toolbar { border-bottom: 1px solid var(--sidebar-line); padding: 12px 16px 10px; }
.group-toolbar-title { display: flex; align-items: center; justify-content: space-between; color: var(--sidebar-muted); font-size: 12px; font-weight: 700; }
.group-toolbar-actions { display: flex; gap: 2px; }
.mini-icon-button { width: 28px; height: 28px; border: 0; background: transparent; color: var(--sidebar-muted); cursor: pointer; border-radius: 6px; display: grid; place-items: center; }
.mini-icon-button:hover { background: #e5e8e2; color: var(--sidebar-text); }
.group-list { display: grid; gap: 3px; margin-top: 7px; max-height: 180px; overflow: auto; }
.group-item { display: flex; align-items: center; gap: 8px; width: 100%; border: 1px solid transparent; background: transparent; color: var(--sidebar-muted); padding: 7px 8px; border-radius: 6px; text-align: left; cursor: pointer; font-size: 13px; }
.group-item:hover { background: #e9ece7; color: var(--sidebar-text); }
.group-item.active { background: white; border-color: #c8ccc5; color: #202320; box-shadow: 0 1px 3px rgba(30,35,30,0.06); }
.group-item img { width: 24px; height: 24px; object-fit: cover; border-radius: 4px; background: var(--line); }
.group-item span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-item b { font-size: 11px; color: inherit; opacity: 0.72; font-weight: 700; }

.template-item { width: 100%; display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 9px; margin-bottom: 4px; color: var(--sidebar-text); text-align: left; background: transparent; border: 1px solid transparent; border-radius: 6px; }
.template-item:hover { background: #eceeea; }
.template-item.active { background: #fff4f1; border-color: #d8a49c; box-shadow: inset 3px 0 0 var(--red); }
.template-thumb { width: 52px; height: 52px; overflow: hidden; border-radius: 5px; background: white; border: 1px solid #d5d8d2; }
.template-thumb img { width: 100%; height: 100%; object-fit: cover; }
.template-info { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.template-info strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.template-info span { font-size: 11px; color: var(--sidebar-muted); }
.template-frame-count { font-size: 10px; padding: 3px 6px; color: #4d524c; background: #e5e8e2; border-radius: 4px; }
.template-type-badge { display: inline-flex; width: fit-content; padding: 2px 4px; border: 1px solid #c6cbc4; border-radius: 3px; color: #4f554e; background: white; font-size: 8px; line-height: 1.2; }
.template-type-badge.aliyun { border-color: #476985; color: #cfe3f3; background: #263b4d; }
.panel-footer { display: flex; align-items: center; border-top: 1px solid var(--sidebar-line); padding: 8px; background: white; }
.text-command { flex: 1; padding: 8px; display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--sidebar-text); background: transparent; font-size: 12px; border-radius: 5px; }
.text-command:hover { background: #eceeea; color: var(--sidebar-text); }
.text-command.danger:hover { color: #ff9b92; }

.manager-panel { min-width: 0; min-height: 0; overflow: auto; background: #f3f4f1; }
.manager-heading { min-height: 118px; padding: 24px 28px 20px; display: flex; align-items: center; justify-content: space-between; gap: 24px; background: white; border-bottom: 1px solid var(--line); }
.manager-heading h1 { margin: 5px 0 5px; font-size: 24px; }
.manager-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.manager-heading-actions { display: flex; align-items: center; gap: 10px; }
.manager-search { width: 260px; height: 40px; padding: 0 11px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 6px; background: #fafbf9; color: var(--muted); }
.manager-search input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 12px; }
.batch-toolbar { min-height: 64px; padding: 11px 28px; position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 18px; background: rgba(255,255,255,0.96); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px); }
.batch-select-all { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 12px; font-weight: 700; white-space: nowrap; }
.batch-select-all input, .template-card-check input { width: 17px; height: 17px; accent-color: var(--red); }
.batch-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; flex-wrap: wrap; }
.batch-actions .button { min-height: 34px; padding: 0 10px; font-size: 11px; }
.batch-actions button:disabled, .batch-move select:disabled { opacity: 0.42; cursor: not-allowed; }
.batch-move { height: 34px; padding-left: 9px; display: flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); background: #f6f7f4; font-size: 10px; }
.batch-move select { height: 32px; max-width: 135px; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 11px; }
.manager-grid { padding: 24px 28px 40px; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); align-content: start; gap: 16px; }
.manager-empty { grid-column: 1 / -1; min-height: 240px; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.template-card { min-width: 0; overflow: hidden; position: relative; border: 1px solid #d9dcd6; border-radius: 9px; background: white; box-shadow: 0 3px 12px rgba(32,35,31,0.04); transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease; }
.template-card:hover { transform: translateY(-1px); border-color: #b9bdb6; box-shadow: 0 7px 20px rgba(32,35,31,0.09); }
.template-card.selected { border-color: #d1847a; box-shadow: 0 0 0 2px rgba(200,58,48,0.12); }
.template-card-preview { width: 100%; aspect-ratio: 1; position: relative; overflow: hidden; border-bottom: 1px solid var(--line); background-color: white; background-image: linear-gradient(45deg,#e7e7e3 25%,transparent 25%),linear-gradient(-45deg,#e7e7e3 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#e7e7e3 75%),linear-gradient(-45deg,transparent 75%,#e7e7e3 75%); background-size: 20px 20px; background-position: 0 0,0 10px,10px -10px,-10px 0; }
.template-card-preview img { width: 100%; height: 100%; object-fit: contain; display: block; }
.template-card-check { position: absolute; left: 10px; top: 10px; z-index: 2; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 7px; background: rgba(255,255,255,0.94); box-shadow: 0 2px 8px rgba(0,0,0,0.14); }
.template-card-state { position: absolute; right: 9px; top: 9px; display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.card-badge { padding: 4px 6px; border-radius: 4px; color: #555a54; background: rgba(255,255,255,0.94); box-shadow: 0 1px 5px rgba(0,0,0,0.10); font-size: 9px; font-weight: 800; }
.card-badge.published { color: white; background: var(--teal); }
.card-badge.hidden { color: white; background: #656a64; }
.template-card-body { padding: 12px; }
.template-card-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.template-card-title strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.template-card-title span { flex: 0 0 auto; color: var(--muted); font-size: 10px; }
.template-card-meta { margin: 8px 0 11px; display: flex; flex-wrap: wrap; gap: 5px; }
.template-card-meta span { padding: 3px 5px; border-radius: 3px; color: #5d625c; background: #eff1ed; font-size: 9px; }
.template-card-actions { display: flex; gap: 7px; }
.template-card-actions button { flex: 1; min-height: 32px; border: 1px solid var(--line); border-radius: 5px; background: #fafbf9; color: var(--ink); font-size: 11px; font-weight: 700; }
.template-card-actions button:hover { border-color: #b8aaa6; background: #fff7f5; }

.stage-panel { display: grid; grid-template-rows: 70px minmax(300px, 1fr) auto 186px; overflow-y: auto; background: var(--workspace); border-right: 1px solid var(--line); }
.template-bar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 22px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,0.58); }
.template-title-wrap { display: flex; align-items: center; gap: 12px; min-width: 0; }
.template-title-wrap h1 { margin: 0; font-size: 17px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.template-title-wrap p { margin: 5px 0 0; font-size: 11px; color: var(--muted); }
.status-badge { flex: 0 0 auto; padding: 4px 7px; border-radius: 4px; background: #eee7db; color: #735c2f; font-size: 10px; font-weight: 800; }
.status-badge.ready { color: #245d55; background: var(--teal-soft); }
.status-badge.published { color: white; background: var(--teal); }
.preview-actions { display: flex; align-items: center; gap: 4px; }

.stage-area { min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 18px; overflow: hidden; }
.canvas-wrap { width: 360px; height: 360px; flex: 0 0 auto; background: white; box-shadow: var(--shadow); border: 1px solid #d8d7d1; overflow: hidden; }
.sticker-canvas, .frame-thumb, .template-thumb { background-color: #fff; background-image: linear-gradient(45deg, #e7e7e3 25%, transparent 25%), linear-gradient(-45deg, #e7e7e3 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #e7e7e3 75%), linear-gradient(-45deg, transparent 75%, #e7e7e3 75%); background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0; }
.sticker-canvas { width: 100%; height: 100%; position: relative; overflow: hidden; container-type: inline-size; }
.base-image { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; transform-origin: center; will-change: transform, opacity; }
.layer-root { position: absolute; inset: 0; pointer-events: none; }
.empty-canvas { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: #aaa8a1; font-size: 12px; }
.empty-canvas svg { width: 34px; height: 34px; }
.canvas-readout { width: 360px; min-width: 0; flex: 0 0 auto; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin-top: 10px; color: var(--muted); font-size: 11px; }
.canvas-readout span:nth-child(2) { justify-self: center; }
.canvas-readout span:last-child { justify-self: end; color: var(--teal); }

.generation-trace { max-height: 250px; overflow: auto; padding: 12px 18px 14px; background: #f8f8f5; border-top: 1px solid var(--line); }
.trace-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.trace-heading strong { font-size: 13px; }
.trace-heading span { color: var(--muted); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trace-frame + .trace-frame { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.trace-frame-title { margin-bottom: 7px; color: var(--muted); font-size: 11px; font-weight: 700; }
.trace-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.trace-item { min-width: 0; color: var(--ink); text-decoration: none; }
.trace-item img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; background: white; border: 1px solid var(--line); }
.trace-item span { display: block; margin-top: 4px; font-size: 10px; text-align: center; }
.trace-item:hover img { border-color: var(--teal); }

.text-layer { position: absolute; transform: translate(-50%, -50%) rotate(var(--text-rotate)); white-space: nowrap; line-height: 1; font-size: calc(var(--font-size) * 1cqw / 3.6); font-weight: var(--font-weight); color: var(--fill); -webkit-text-stroke: calc(var(--stroke-width) * 1cqw / 3.6) var(--stroke); paint-order: stroke fill; text-shadow: 0 1px 1px rgba(0,0,0,0.08); }
.text-layer .layer-content { display: block; }
.effect-layer { position: absolute; width: 48px; height: 48px; transform: translate(-50%, -50%) scale(var(--effect-scale)) rotate(var(--effect-rotate)); opacity: var(--effect-opacity); display: grid; place-items: center; transform-origin: center; }
.effect-visual { width: 100%; height: 100%; display: grid; place-items: center; }
.effect-layer img { width: 100%; height: 100%; object-fit: contain; }
.sparkle-shape { width: 34px; height: 34px; position: relative; color: var(--effect-color); }
.sparkle-shape::before, .sparkle-shape::after { content: ""; position: absolute; left: 50%; top: 50%; background: currentColor; transform: translate(-50%, -50%); border-radius: 2px; }
.sparkle-shape::before { width: 100%; height: 4px; }
.sparkle-shape::after { width: 4px; height: 100%; }
.steam-shape { width: 54px; height: 52px; display: flex; justify-content: space-around; align-items: end; color: var(--effect-color); }
.steam-shape span { display: block; width: 9px; height: 42px; border-left: 3px solid currentColor; border-radius: 50%; transform: rotate(12deg); opacity: 0.7; }
.steam-shape span:nth-child(2) { height: 50px; transform: rotate(-8deg); }
.envelope-shape { width: 48px; height: 40px; background: #df3027; border-radius: 4px; position: relative; box-shadow: inset 0 0 0 2px #b9211b; }
.envelope-shape::before { content: ""; position: absolute; left: 7px; top: 6px; width: 34px; height: 18px; background: #f04337; clip-path: polygon(0 0, 50% 70%, 100% 0); }
.envelope-shape::after { content: ""; position: absolute; width: 12px; height: 12px; border-radius: 50%; background: var(--gold); left: 18px; top: 20px; }
.coin-shape { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; color: #8b5a07; background: var(--gold); border: 4px solid #f5c958; font-size: 18px; font-weight: 900; }
.heart-shape { color: var(--effect-color); font-size: 42px; line-height: 1; }
.confetti-shape { position: relative; width: 78px; height: 78px; }
.confetti-shape span { position: absolute; width: 8px; height: 18px; background: var(--effect-color); border-radius: 2px; }
.confetti-shape span:nth-child(1) { left: 8px; top: 12px; transform: rotate(22deg); background: #d83b32; }
.confetti-shape span:nth-child(2) { left: 30px; top: 3px; transform: rotate(-15deg); background: #d7a229; }
.confetti-shape span:nth-child(3) { right: 8px; top: 18px; transform: rotate(35deg); background: #2d7c73; }
.confetti-shape span:nth-child(4) { left: 18px; bottom: 5px; transform: rotate(-30deg); background: #ef6b37; }
.confetti-shape span:nth-child(5) { right: 22px; bottom: 10px; transform: rotate(12deg); background: #cf4e78; }
.layer-content.anim-pop { animation: content-pop 380ms ease both; }
.effect-visual.anim-pop { animation: effect-pop 380ms ease both; }
.anim-pulse { animation: pulse 600ms ease-in-out infinite alternate; }
.anim-float { animation: float 700ms ease-in-out infinite alternate; }
.anim-blink { animation: blink 380ms steps(2, jump-none) infinite; }
.anim-spin { animation: spin 850ms linear infinite; }
@keyframes content-pop { from { transform: scale(0.65); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes effect-pop { from { transform: scale(0.65); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes pulse { to { filter: brightness(1.12); } }
@keyframes float { to { margin-top: -5px; } }
@keyframes blink { 50% { opacity: 0.18; } }
@keyframes spin { to { rotate: 360deg; } }
.spin-icon { animation: spin 850ms linear infinite; }

.editable-layer { pointer-events: auto; touch-action: none; cursor: move; z-index: 2; }
.selection-outline, .transform-handle { display: none; }
.editable-layer.selected { z-index: 8; }
.editable-layer.selected .selection-outline { display: block; position: absolute; inset: -8px; border: 1px solid #1677ff; pointer-events: none; }
.transform-handle { position: absolute; z-index: 20; width: 28px; height: 28px; padding: 0; place-items: center; border: 1px solid #0d5dcc; border-radius: 50%; background: white; color: #0d5dcc; box-shadow: 0 2px 7px rgba(0,0,0,0.18); -webkit-text-stroke: 0; pointer-events: auto; touch-action: none; }
.transform-handle svg { width: 12px; height: 12px; }
.editable-layer.selected .transform-handle { display: grid; }
.scale-handle { right: -31px; bottom: -31px; cursor: nwse-resize; }
.rotate-handle { left: 50%; top: -48px; transform: translateX(-50%); cursor: grab; }
.rotate-handle::after { content: ""; position: absolute; width: 1px; height: 20px; left: 50%; top: 27px; background: #1677ff; }

.timeline-panel { background: white; border-top: 1px solid var(--line); padding: 14px 18px 16px; min-width: 0; }
.timeline-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.timeline-heading > div:first-child { display: flex; align-items: baseline; gap: 8px; }
.timeline-heading strong { font-size: 13px; }
.timeline-heading span { font-size: 10px; color: var(--muted); }
.timeline-tools { display: flex; gap: 2px; }
.timeline { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.frame-tile { flex: 0 0 102px; height: 112px; padding: 5px; border: 1px solid var(--line); border-radius: 6px; background: #f8f8f5; text-align: left; color: var(--ink); }
.frame-tile.active { border-color: var(--red); box-shadow: inset 0 0 0 1px var(--red); background: #fff8f6; }
.frame-thumb { display: block; width: 90px; height: 78px; overflow: hidden; border: 1px solid #e1e0db; position: relative; }
.frame-thumb img { width: 100%; height: 100%; object-fit: cover; transform-origin: center; }
.frame-mode-badge { position: absolute; left: 4px; top: 4px; z-index: 2; min-width: 24px; padding: 2px 4px; border-radius: 3px; color: white; background: var(--teal); font-size: 8px; line-height: 1.2; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,0.16); }
.frame-mode-badge.inherit { background: #595752; }
.frame-mode-badge.face-swap { background: #84612b; }
.frame-mode-badge.face-swap.registered { background: #315c82; }
.frame-mode-badge.face-swap.complete { background: var(--teal); }
.frame-caption { display: flex; justify-content: space-between; align-items: center; margin-top: 5px; font-size: 10px; }
.frame-caption span:last-child { color: var(--muted); }

.inspector-panel { background: var(--paper); display: grid; grid-template-rows: 58px minmax(0, 1fr); }
.inspector-tabs { display: grid; grid-template-columns: repeat(5, 1fr); border-bottom: 1px solid var(--line); }
.inspector-tabs button { min-width: 0; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 10px; }
.inspector-tabs button svg { width: 17px; height: 17px; }
.inspector-tabs button.active { color: var(--red); border-bottom-color: var(--red); }
.inspector-tabs button[hidden] { display: none; }
.inspector-panel.face-swap .inspector-tabs { grid-template-columns: 1fr; }
.inspector-scroll { min-height: 0; overflow-y: auto; }
.inspector-section { display: none; padding: 18px; }
.inspector-section.active { display: block; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.section-title strong { font-size: 13px; }
.section-title span { color: var(--muted); font-size: 10px; }
.split-top { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.field-grid { display: grid; gap: 10px; }
.two-cols { grid-template-columns: 1fr 1fr; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; color: var(--muted); font-size: 11px; }
.field input, .field select, .field textarea { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 5px; background: #fbfbf9; color: var(--ink); outline: 0; }
.field input, .field select { height: 38px; padding: 0 10px; }
.field input:focus, .field select:focus, .prompt-editor:focus { border-color: #9d756e; box-shadow: 0 0 0 3px rgba(200,58,48,0.08); }
.template-type-readout { min-height: 42px; margin-top: 4px; padding: 9px 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--line); border-radius: 5px; background: #f7f7f3; }
.template-type-readout span { color: var(--muted); font-size: 10px; }
.template-type-readout strong { font-size: 11px; }
.animation-mode-field { margin-top: 6px; }
.animation-mode-field .segmented-control { margin-bottom: 6px; }
.field-help { margin: 0 0 10px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.motion-delta-summary { display: flex; align-items: center; gap: 7px; margin: 0 0 12px; padding: 9px 10px; border-left: 3px solid var(--red); background: #fff3f0; color: #7b2d26; font-size: 11px; line-height: 1.4; }
.motion-delta-summary svg { width: 15px; height: 15px; flex: 0 0 auto; }
.motion-delta-summary.base, .motion-delta-summary.unchanged { border-left-color: var(--line-strong); background: #f4f4f0; color: var(--muted); }
.range-control.changed { margin-left: -8px; margin-right: -8px; padding: 7px 8px; border-radius: 5px; background: #fff3f0; }
.range-control.changed > span { color: #9f2f26; font-weight: 700; }
.reference-drop { width: 100%; aspect-ratio: 16 / 9; position: relative; overflow: hidden; padding: 0; border: 1px dashed var(--line-strong); border-radius: 6px; background: #f6f6f2; color: var(--muted); }
.reference-drop img { width: 100%; height: 100%; object-fit: contain; display: none; }
.reference-drop.has-image img { display: block; }
.reference-drop > span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 7px; font-size: 12px; }
.reference-drop.has-image > span { display: none; }
.reference-drop b { position: absolute; right: 7px; bottom: 7px; display: none; align-items: center; gap: 5px; padding: 5px 7px; border-radius: 4px; color: white; background: rgba(20,20,19,0.82); font-size: 10px; }
.reference-drop:hover b { display: flex; }
.metric-row { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 14px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.metric-row div { padding: 11px 8px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.metric-row div:last-child { border-right: 0; }
.metric-row span { font-size: 9px; color: var(--muted); }
.metric-row strong { font-size: 11px; }
.gif-import-info { margin-top: 12px; min-height: 48px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 9px; padding: 9px 10px; border: 1px solid #cbded9; border-radius: 6px; background: #f2f8f6; color: var(--teal); }
.gif-import-info[hidden] { display: none; }
.gif-import-info > div { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.gif-import-info strong { color: var(--ink); font-size: 11px; }
.gif-import-info span { color: var(--muted); font-size: 10px; }
.gif-import-info a { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 4px; color: var(--teal); }
.gif-import-info a:hover { background: #deeeea; }
.provider-info { margin-top: 12px; min-height: 56px; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px; padding: 10px; border-left: 3px solid #315c82; background: #eef5fb; color: #315c82; }
.provider-info > svg { width: 20px; height: 20px; }
.provider-info > div { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.provider-info strong { color: var(--ink); font-size: 11px; }
.provider-info span { color: var(--muted); font-size: 10px; line-height: 1.5; }
.provider-info.mock { border-left-color: #84612b; background: #faf4e8; color: #84612b; }
.provider-info.ready { border-left-color: var(--teal); background: #f2f8f6; color: var(--teal); }

.prompt-editor { width: 100%; min-height: 360px; resize: vertical; padding: 12px; border: 1px solid var(--line); border-radius: 5px; outline: 0; background: #fbfbf9; color: var(--ink); line-height: 1.7; font-size: 13px; }
.frame-prompt-editor { min-height: 170px; }
.common-prompt-editor { min-height: 240px; }
.frame-prompt-status { min-height: 34px; margin-top: 9px; padding: 8px 9px; display: flex; align-items: center; gap: 7px; border-left: 3px solid var(--teal); background: #f2f8f6; color: #315f59; font-size: 10px; line-height: 1.45; }
.frame-prompt-status.inherit { border-left-color: #77736b; background: #f3f2ef; color: #656159; }
.frame-prompt-status svg { width: 14px; height: 14px; }
.prompt-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.prompt-tools button { padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; background: white; color: var(--muted); font-size: 10px; }
.prompt-tools button:hover { border-color: #a9a69d; color: var(--ink); }
.prompt-checks { margin-top: 16px; border-top: 1px solid var(--line); }
.prompt-check { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-bottom: 1px solid #efeee9; color: var(--muted); font-size: 11px; }
.prompt-check svg { width: 15px; height: 15px; color: var(--red); }
.prompt-check.ok svg { color: var(--teal); }

.frame-generation-panel { margin-bottom: 20px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.frame-generation-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.frame-generation-heading strong { font-size: 11px; }
.frame-generation-heading span { color: var(--teal); font-size: 10px; }
.segmented-control { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 13px; padding: 3px; border: 1px solid var(--line); border-radius: 6px; background: #efeee9; }
.segmented-control button { min-height: 34px; border: 0; border-radius: 4px; background: transparent; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 11px; font-weight: 700; }
.segmented-control button.active { background: white; color: var(--ink); box-shadow: 0 1px 4px rgba(28,27,24,0.12); }
.segmented-control button:disabled { opacity: 0.38; }
.segmented-control svg { width: 14px; height: 14px; }
.control-stack { display: flex; flex-direction: column; gap: 17px; }
.range-control { display: grid; grid-template-columns: 74px minmax(0, 1fr) 66px; align-items: center; gap: 9px; }
.range-control > span { color: var(--muted); font-size: 11px; }
.range-control input[type="range"] { width: 100%; accent-color: var(--red); }
.range-control input[type="number"] { width: 66px; height: 32px; border: 1px solid var(--line); border-radius: 4px; padding: 0 7px; text-align: right; }
.frame-analysis { margin-top: 22px; padding-top: 17px; border-top: 1px solid var(--line); }
.frame-analysis[hidden] { display: none; }
.frame-analysis span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 10px; }
.frame-analysis p { margin: 0 0 14px; color: var(--ink); font-size: 12px; line-height: 1.65; }
.frame-analysis textarea { width: 100%; min-height: 120px; resize: vertical; padding: 10px; border: 1px solid var(--line); border-radius: 5px; background: #fbfbf9; color: var(--ink); font-size: 12px; line-height: 1.6; outline: 0; }

.mini-command { padding: 5px 7px; display: inline-flex; align-items: center; gap: 4px; border-radius: 4px; background: #efeee9; color: var(--ink); font-size: 10px; }
.layer-list { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.layer-item { width: 100%; min-height: 40px; padding: 7px 9px; display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 1px solid var(--line); border-radius: 5px; background: white; color: var(--ink); text-align: left; font-size: 11px; }
.layer-item.active { border-color: #9d756e; background: #fff8f6; }
.layer-item span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.layer-item small { color: var(--muted); flex: 0 0 auto; }
.layer-editor:empty::before { content: "未选择图层"; display: block; padding: 18px; text-align: center; color: #aaa8a1; border: 1px dashed var(--line); border-radius: 5px; font-size: 11px; }
.editor-heading { display: flex; align-items: center; justify-content: space-between; margin: 18px 0 12px; padding-top: 15px; border-top: 1px solid var(--line); }
.editor-heading strong { font-size: 12px; }
.remove-layer { width: 30px; height: 30px; border: 0; border-radius: 4px; display: grid; place-items: center; background: #f7e8e6; color: var(--red); }
.transform-readout { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0 0 14px; border: 1px solid var(--line); border-radius: 5px; background: #f7f7f3; }
.transform-readout span { min-width: 0; height: 36px; display: flex; align-items: center; justify-content: center; gap: 5px; border-right: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.transform-readout span:last-child { border-right: 0; }
.transform-readout svg { width: 13px; height: 13px; }

.effect-library { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.effect-preset { min-height: 62px; padding: 7px 4px; border: 1px solid var(--line); border-radius: 5px; background: #fbfbf9; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; color: var(--ink); font-size: 10px; }
.effect-preset:hover { border-color: #aa776e; background: #fff8f6; }
.effect-glyph { height: 25px; min-width: 28px; display: grid; place-items: center; color: var(--gold); font-size: 24px; font-weight: 900; }
.upload-command { width: 100%; min-height: 38px; margin-top: 9px; border: 1px dashed var(--line-strong); border-radius: 5px; background: white; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 7px; font-size: 11px; }
.upload-command:hover { color: var(--ink); border-color: #9d756e; }
.color-row { display: grid; grid-template-columns: 1fr 52px; gap: 8px; }
.field input[type="color"] { padding: 3px; }

.toast-region { position: fixed; right: 18px; bottom: 18px; z-index: 50; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; }
.toast { max-width: 340px; padding: 11px 13px; color: white; background: var(--charcoal); border-left: 4px solid var(--teal); border-radius: 5px; box-shadow: var(--shadow); font-size: 12px; line-height: 1.5; animation: toast-in 180ms ease both; }
.toast.error { border-left-color: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.confirm-dialog { width: min(420px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 7px; box-shadow: 0 24px 70px rgba(0,0,0,0.24); }
.confirm-dialog::backdrop { background: rgba(20,20,18,0.45); }
.confirm-dialog form { padding: 24px; }
.group-dialog form { min-width: 380px; }
.group-dialog .field { margin-top: 14px; }
.dialog-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: #f4ead5; color: #8b6615; }
.dialog-icon.danger { background: var(--red-soft); color: var(--red); }
.confirm-dialog h2 { margin: 15px 0 7px; font-size: 18px; }
.confirm-dialog p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.65; white-space: pre-line; }
.dialog-actions { margin-top: 22px; display: flex; justify-content: flex-end; gap: 8px; }

.template-type-dialog { width: min(500px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 7px; box-shadow: 0 24px 70px rgba(0,0,0,0.24); }
.template-type-dialog::backdrop { background: rgba(20,20,18,0.45); }
.template-type-dialog form { padding: 22px; }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.dialog-heading h2 { margin: 4px 0 0; font-size: 18px; }
.template-type-options { display: grid; gap: 9px; }
.template-type-option { width: 100%; min-height: 76px; padding: 12px; display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 6px; background: white; color: var(--ink); text-align: left; }
.template-type-option:hover { border-color: #9d756e; background: #fffafa; }
.template-type-option > span:nth-child(2) { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.template-type-option strong { font-size: 13px; }
.template-type-option small { color: var(--muted); font-size: 10px; line-height: 1.4; }
.template-type-option > svg { width: 17px; height: 17px; color: var(--muted); }
.template-type-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 5px; }
.template-type-icon svg { width: 20px; height: 20px; }
.template-type-icon.seedream { color: var(--red); background: var(--red-soft); }
.template-type-icon.aliyun { color: #315c82; background: #e5eff8; }

@media (max-width: 1180px) {
  .workspace { grid-template-columns: 220px minmax(340px, 1fr) 300px; }
  .topbar { grid-template-columns: 220px minmax(40px, 1fr) auto; gap: 10px; }
  .top-actions { gap: 5px; }
  .top-actions .button { padding: 0 10px; }
  .top-actions .button small { display: none; }
  .subject-button { padding-right: 7px; }
  body.manager-mode .workspace { grid-template-columns: 220px minmax(0, 1fr); }
  .manager-heading, .batch-toolbar { padding-left: 20px; padding-right: 20px; }
  .manager-grid { padding: 20px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
}

@media (max-height: 820px) and (min-width: 901px) {
  .stage-panel { grid-template-rows: 62px minmax(0, 1fr) auto 154px; }
  .template-bar { padding: 0 16px; }
  .stage-area { padding: 12px 16px; }
  .timeline-panel { padding: 10px 14px 12px; }
  .timeline-heading { margin-bottom: 7px; }
  .frame-tile { flex-basis: 88px; height: 96px; }
  .frame-thumb { width: 76px; height: 64px; }
}

@media (max-width: 900px) {
  body { overflow: auto; }
  .topbar { height: auto; min-height: 64px; grid-template-columns: 1fr auto; padding: 10px 12px; position: sticky; top: 0; }
  .document-state { display: none; }
  .top-actions { min-width: 0; }
  .subject-button span:last-child, .button small { display: none; }
  .workspace { height: auto; display: grid; grid-template-columns: 1fr; }
  .template-panel { grid-template-rows: auto auto auto; }
  .template-list { display: flex; overflow-x: auto; padding: 0 10px 10px; }
  .template-item { flex: 0 0 210px; margin: 0 5px 0 0; }
  .panel-footer { display: none; }
  .stage-panel { min-height: 720px; grid-template-rows: 70px minmax(420px, 1fr) auto 184px; border-right: 0; }
  .canvas-wrap, .canvas-readout { min-width: 0; }
  .inspector-panel { min-height: 680px; border-top: 1px solid var(--line); }
  .inspector-scroll { overflow: visible; }
  body.manager-mode .workspace { grid-template-columns: 1fr; }
  body.manager-mode .template-panel { display: block; }
  body.manager-mode .group-toolbar { border-bottom: 0; }
  body.manager-mode .group-list { display: flex; max-height: none; overflow-x: auto; }
  body.manager-mode .group-item { flex: 0 0 auto; width: auto; }
  .manager-heading { align-items: flex-start; }
  .manager-heading-actions { flex-direction: column; align-items: stretch; }
  .manager-search { width: 220px; }
  .batch-toolbar { position: static; align-items: flex-start; flex-direction: column; }
  .batch-actions { justify-content: flex-start; }
  .baby-album-heading { padding: 20px; align-items: flex-start; flex-direction: column; }
  .baby-album-specs { justify-content: flex-start; }
  .baby-album-content { width: calc(100% - 28px); padding: 18px 0 30px; grid-template-columns: 1fr; }
  .baby-album-result { min-height: 420px; }
  .baby-result-empty, .baby-result-progress, .baby-result-failure { min-height: 420px; }
}

@media (max-width: 560px) {
  .brand span { display: none; }
  .brand img { width: 34px; height: 34px; }
  .top-actions { gap: 4px; }
  .top-actions .button { width: 38px; padding: 0; }
  .top-actions .button span { display: none; }
  .subject-button { width: 40px; padding: 3px; }
  .workspace { min-width: 0; }
  .template-panel .panel-heading { padding-top: 12px; }
  .stage-panel { min-height: 650px; grid-template-rows: 64px minmax(350px, 1fr) auto 174px; }
  .template-bar { padding: 0 12px; }
  .template-title-wrap { gap: 7px; }
  .template-title-wrap h1 { font-size: 15px; }
  .stage-area { padding: 12px; }
  .timeline-panel { padding: 12px; }
  .frame-tile { flex-basis: 92px; height: 104px; }
  .frame-thumb { width: 80px; height: 70px; }
  .inspector-section { padding: 16px 14px 28px; }
  .two-cols { grid-template-columns: 1fr; gap: 0; }
  .effect-library { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .range-control { grid-template-columns: 62px minmax(0, 1fr) 60px; gap: 6px; }
  .manager-heading { padding: 18px 14px; flex-direction: column; }
  .manager-heading-actions, .manager-search { width: 100%; }
  .batch-toolbar { padding: 10px 14px; }
  .manager-grid { padding: 14px; grid-template-columns: 1fr 1fr; gap: 10px; }
  .template-card-body { padding: 9px; }
  .template-card-meta { display: none; }
  .baby-album-heading h1 { font-size: 21px; }
  .baby-frame-grid { grid-template-columns: 1fr; }
  .baby-frame-upload { grid-template-columns: 90px minmax(0, 1fr); }
  .baby-frame-preview { width: 90px; }
  .baby-album-section { padding: 16px; }
  .baby-form-actions { align-items: stretch; flex-direction: column; }
  .baby-form-actions .button { width: 100%; }
  .baby-result-footer { align-items: stretch; flex-direction: column; }
  .baby-result-footer .button { width: 100%; }
}
