/* ============ studio: conversation + structured draft canvas ============ */
.page-studio.page-full { padding-bottom: 16px; }
.studio { display: grid; grid-template-columns: minmax(360px, 0.9fr) minmax(0, 1.25fr); gap: 16px; height: calc(100vh - 92px); min-height: 560px; }
.chat-col, .canvas-col { min-height: 0; display: flex; flex-direction: column; background: var(--sheet); border: 1px solid var(--rule-soft); border-radius: var(--radius-lg); box-shadow: var(--shadow-paper); overflow: hidden; }

/* chat */
.chat-scroll { flex: 1; overflow-y: auto; padding: 18px 18px 8px; display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; }
.msg { display: flex; gap: 10px; max-width: 100%; animation: rise-in 360ms var(--ease-out) both; }
.msg.user { justify-content: flex-end; }
.msg.user .bubble { background: var(--ink); color: var(--sheet); border-radius: 16px 16px 4px 16px; padding: 10px 14px; max-width: 86%; white-space: pre-wrap; font-size: var(--text-base); }
.msg.assistant .bubble { flex: 1; min-width: 0; }
.msg-head { display: flex; align-items: center; gap: 8px; margin: 2px 0 4px; font-size: var(--text-xs); }
.msg-head strong { font-weight: 600; color: var(--ink-2); }
.provider { font-size: 11px; color: var(--ochre); background: var(--ochre-soft); padding: 1px 7px; border-radius: 999px; }
.ai-seal { width: 26px; height: 26px; padding: 0; flex: none; font-size: 12px; margin-top: 2px; border-radius: 6px; transform: rotate(-4deg); }
.ai-seal.big { width: 44px; height: 44px; font-size: 20px; border-radius: 9px; }
.markdown { font-size: var(--text-base); line-height: 1.75; color: var(--ink); overflow-wrap: anywhere; }
.markdown p { margin: 0 0 8px; }
.markdown ul, .markdown ol { margin: 4px 0 8px; padding-left: 20px; }
.markdown li { margin: 2px 0; }
.markdown h1, .markdown h2, .markdown h3, .markdown h4 { font-size: 15.5px; margin: 10px 0 6px; }
.markdown blockquote { margin: 6px 0; padding: 4px 12px; border-left: 3px solid var(--rose-soft); color: var(--ink-2); }
.markdown table { border-collapse: collapse; margin: 8px 0; font-size: var(--text-sm); display: block; overflow-x: auto; }
.markdown th, .markdown td { border: 1px solid var(--rule-soft); padding: 5px 8px; text-align: left; vertical-align: top; }
.markdown th { background: var(--paper-deep); font-weight: 600; }
.markdown code { font-family: var(--font-mono); font-size: 12px; background: var(--paper-deep); padding: 1px 4px; border-radius: 4px; }
.markdown .cite, .cite-chip { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; margin: 0 2px; border-radius: 5px; border: 1px solid var(--celadon-soft); background: #eef4ef; color: #3c5c4c; font-size: 11px; cursor: pointer; font-family: var(--font-body); vertical-align: 1px; }
.cite-chip:hover, .markdown .cite:hover { border-color: var(--celadon); }
.citations { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 8px; font-size: 11px; }
.draft-chip { display: inline-flex; align-items: center; gap: 6px; margin: 6px 0 2px; padding: 5px 10px; border-radius: 8px; border: 1px solid var(--rose-soft); background: var(--rose-wash); color: var(--rose-deep); font-size: var(--text-xs); cursor: pointer; }
.draft-chip:hover { border-color: var(--rose); }
.msg-error { display: flex; align-items: center; gap: 6px; color: var(--rose-deep); font-size: var(--text-sm); padding: 6px 10px; background: var(--rose-wash); border-radius: 8px; }
.msg-images { display: flex; gap: 8px; margin: 8px 0; }
.msg-image { width: 132px; aspect-ratio: 3 / 4; border-radius: 10px; overflow: hidden; border: 1px solid var(--rule-soft); padding: 0; cursor: pointer; background: var(--paper-deep); }
.msg-image img { width: 100%; height: 100%; object-fit: cover; }
.typing { display: inline-flex; gap: 4px; padding: 8px 0; }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-4); animation: blink 1.2s infinite both; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }
.writing { display: inline-flex; align-items: center; gap: 8px; color: var(--rose-deep); font-size: var(--text-sm); margin: 4px 0; }
.chat-intro { margin: auto; max-width: 440px; text-align: left; display: flex; flex-direction: column; gap: 12px; padding: 12px 4px 24px; }
.chat-intro h3 { font-size: 20px; line-height: 1.4; }
/* Once the conversation starts the brief stays on top as its opening, not centred in the column. */
.chat-intro.started { margin: 0 auto; width: 100%; max-width: 520px; gap: 10px; padding: 2px 2px 16px; border-bottom: 1px dashed var(--rule); }
.chat-intro.started h3 { font-size: 17px; }
.chat-intro.started .ai-seal.big { width: 34px; height: 34px; font-size: 15px; }
.chat-intro .link-button { align-self: flex-start; margin-top: -4px; }
/* candidates the AI offers; nothing reaches the draft until one is picked */
.options { margin: 8px 0 4px; border: 1px solid var(--rule-soft); border-radius: 12px; background: var(--sheet-raised); overflow: hidden; }
.options-head { margin: 0; padding: 7px 12px; font-size: var(--text-xs); color: var(--ink-3); background: var(--paper); border-bottom: 1px solid var(--rule-soft); }
.options ol { list-style: none; margin: 0; padding: 0; }
.option { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--rule-soft); transition: background var(--duration-fast); }
.option:first-child { border-top: 0; }
.option:hover { background: var(--paper); }
.option-index { flex: none; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 600; color: var(--ink-3); border: 1px solid var(--rule); }
.option-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.option-text strong { font-weight: 600; font-size: var(--text-base); line-height: 1.5; color: var(--ink); overflow-wrap: anywhere; }
.option-text small { font-size: 11.5px; color: var(--ink-3); }
.option .btn { flex: none; }
.option-picked { flex: none; display: inline-flex; align-items: center; gap: 4px; font-size: var(--text-xs); color: var(--rose-deep); }
.option.on { background: var(--rose-wash); }
.option.on .option-index { background: var(--rose); border-color: var(--rose); color: #fff; }
.knows { list-style: none; margin: 0; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; border-radius: 12px; background: var(--paper); border: 1px dashed var(--rule); font-size: var(--text-sm); color: var(--ink-2); }
.knows li { display: flex; align-items: center; gap: 8px; }
.composer { border-top: 1px solid var(--rule-soft); padding: 10px 12px 12px; background: var(--sheet-raised); }
.quick-row { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.quick-row.disabled { opacity: .45; pointer-events: none; }
.quick-row .chip { white-space: nowrap; flex: none; }
.pinned-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 11.5px; }
.pinned-row:not(:empty) { padding-bottom: 8px; }
.pinned-row .tag button { border: 0; background: none; margin-left: 4px; cursor: pointer; color: inherit; }
.composer-box { border: 1px solid var(--rule); border-radius: 14px; background: var(--sheet-raised); transition: border-color var(--duration-fast), box-shadow var(--duration-fast); }
.composer-box:focus-within { border-color: var(--ink-3); box-shadow: 0 0 0 3px rgba(176, 72, 90, .1); }
.composer-box textarea { display: block; width: 100%; border: 0; resize: none; outline: none; background: transparent; padding: 11px 13px 4px; line-height: 1.6; max-height: 180px; }
.composer-actions { display: flex; align-items: center; gap: 4px; padding: 4px 6px 6px; }
.composer-actions .hint { font-size: 11px; color: var(--ink-4); margin-right: 6px; }
#send-button[data-mode="stop"] { --btn-bg: var(--rose); --btn-border: var(--rose); }

/* canvas */
.canvas-head { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--rule-soft); background: var(--sheet-raised); }
.tabs { display: flex; gap: 2px; }
.tabs button { border: 0; background: transparent; padding: 7px 12px; border-radius: 8px; font-size: var(--text-sm); color: var(--ink-3); cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { background: var(--paper-deep); color: var(--ink); font-weight: 600; }
.tabs small { color: var(--rose); font-weight: 600; }
.save-state { font-size: 11.5px; color: var(--ink-3); margin-right: 6px; }
.canvas-body { flex: 1; overflow-y: auto; padding: 20px 24px 40px; }
.canvas-body.flash { animation: canvas-flash 1.4s var(--ease-out); }
.canvas-body.is-busy { position: relative; }
.canvas-body.is-busy > * { pointer-events: none; opacity: .55; transition: opacity var(--duration); }
.canvas-body.is-busy::before { content: "AI 编导正在改稿，完成后会自动更新这里"; position: sticky; top: 0; z-index: 2; display: block; margin: -8px 0 12px; padding: 8px 12px; border-radius: 10px; background: var(--rose-wash); color: var(--rose-deep); font-size: var(--text-sm); border: 1px solid var(--rose-soft); }
@keyframes canvas-flash { 0% { background: var(--rose-wash); } 100% { background: transparent; } }
.canvas-empty { max-width: 420px; margin: 8vh auto 0; text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.canvas-empty h3 { font-size: 22px; }
.canvas-empty p { color: var(--ink-2); }
.format-switch { display: inline-flex; gap: 6px; }
.draft-sheet { display: flex; flex-direction: column; gap: 18px; max-width: 880px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.field-block { display: flex; flex-direction: column; gap: 7px; }
.title-input { border: 0; border-bottom: 1.5px solid var(--rule); background: transparent; padding: 4px 0 8px; font: 600 24px/1.35 var(--font-display); color: var(--ink); outline: none; width: 100%; }
.title-input:focus { border-bottom-color: var(--rose); }
.alt-titles { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: -8px; font-size: 12px; }
.sheet-grid { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 14px; }
.shots-wrap { overflow-x: auto; border: 1px solid var(--rule-soft); border-radius: 12px; background: var(--sheet-raised); }
.shots-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.shots-table th { text-align: left; padding: 8px; font-size: 11px; font-weight: 600; letter-spacing: .06em; color: var(--ink-3); border-bottom: 1px solid var(--rule-soft); background: var(--paper); white-space: nowrap; }
.shots-table td { border-bottom: 1px solid var(--rule-soft); vertical-align: top; padding: 2px; }
.shots-table tr:last-child td { border-bottom: 0; }
.shots-table .shot-no { padding: 10px 8px; font: 600 14px var(--font-numeral); color: var(--rose); width: 28px; }
.shots-table .cell { width: 100%; border: 1px solid transparent; background: transparent; resize: none; padding: 8px 7px; border-radius: 6px; line-height: 1.55; font-size: var(--text-sm); outline: none; min-height: 34px; overflow: hidden; }
.shots-table .cell:focus { border-color: var(--rule); background: #fff; }
.shots-table .cell.voice { font-family: var(--font-hand); font-size: 15px; color: var(--ink); }
.draft-readonly .shots-table td { padding: 8px; }
.tag-editor { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px; border: 1px solid var(--rule-soft); border-radius: 10px; background: var(--sheet-raised); }
.tag-editor .tag button { border: 0; background: none; margin-left: 4px; cursor: pointer; color: var(--ink-3); }
.tag-input { border: 0; outline: none; background: transparent; min-width: 120px; flex: 1; font-size: var(--text-sm); }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.checklist li { display: flex; align-items: center; gap: 8px; }
.checklist .plain { flex: 1; border: 0; border-bottom: 1px dashed var(--rule-soft); background: transparent; padding: 5px 2px; outline: none; font-size: var(--text-sm); }
.checklist input[type="checkbox"] { accent-color: var(--celadon); }
.compliance-panel { border: 1px solid var(--rose-soft); background: var(--rose-wash); border-radius: 12px; padding: 12px 14px; }
.compliance-panel ul { margin: 8px 0 0; padding-left: 18px; font-size: var(--text-sm); display: flex; flex-direction: column; gap: 6px; }
.compliance-panel small { display: block; color: var(--ink-3); }
.compliance-panel s { color: var(--ink-3); }
.body-text { min-height: 110px; }

/* cover tab */
.cover-tab { display: grid; grid-template-columns: minmax(200px, 300px) minmax(0, 1fr); gap: 22px; align-items: start; }
.cover-current { aspect-ratio: 3 / 4; border-radius: 14px; overflow: hidden; background: var(--paper-deep); border: 1px solid var(--rule-soft); box-shadow: var(--shadow-lift); }
.cover-current img { width: 100%; height: 100%; object-fit: cover; }
.cover-placeholder { height: 100%; display: grid; place-content: center; text-align: center; gap: 6px; background: linear-gradient(160deg, var(--rose-wash), var(--paper-deep)); }
.cover-placeholder span { font: 700 26px/1.3 var(--font-display); color: var(--ink-2); padding: 0 16px; }
.cover-placeholder small { color: var(--ink-3); }
.cover-side { display: flex; flex-direction: column; gap: 10px; }
.cover-side h4 { font-size: var(--text-md); }
.ref-strip, .asset-strip { display: flex; gap: 8px; flex-wrap: wrap; }
.asset-thumb { width: 76px; aspect-ratio: 3 / 4; border-radius: 8px; overflow: hidden; padding: 0; border: 2px solid transparent; cursor: pointer; background: var(--paper-deep); }
.asset-thumb.small { width: 56px; }
.asset-thumb img { width: 100%; height: 100%; object-fit: cover; }
.asset-thumb.on { border-color: var(--rose); box-shadow: 0 0 0 3px var(--rose-soft); }
.notice-soft { font-size: var(--text-sm); color: #7c5a22; background: var(--ochre-soft); padding: 8px 12px; border-radius: 8px; }

/* versions */
.version-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.version-list li { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--rule-soft); }
.version-list li div { display: flex; flex-direction: column; }
.version-list small { color: var(--ink-3); font-size: 11.5px; }

/* launcher */
.studio-launch { display: flex; flex-direction: column; gap: 18px; max-width: 1080px; }
.start-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.start-card { display: flex; flex-direction: column; gap: 8px; text-align: left; padding: 18px; border-radius: 16px; border: 1px solid var(--rule-soft); background: var(--sheet); box-shadow: var(--shadow-paper); cursor: pointer; transition: transform var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast), border-color var(--duration-fast); }
.start-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); border-color: var(--rose-soft); }
.start-card strong { font: 600 17px var(--font-display); }
.start-card span:last-child { color: var(--ink-2); font-size: var(--text-sm); }
.start-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--rose-wash); color: var(--rose-deep); }
.session-list { list-style: none; margin: 0; padding: 0; }
.session-list a { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-top: 1px solid var(--rule-soft); color: var(--ink); text-decoration: none; }
.session-list li:first-child a { border-top: 0; }
.session-list a:hover .title { color: var(--rose-deep); }
.session-list .title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-list small { color: var(--ink-3); font-size: 11.5px; white-space: nowrap; }

/* pickers (modals) */
.picker-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; max-height: 52vh; overflow-y: auto; }
.picker-row { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; padding: 9px 10px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; }
.picker-row:hover { background: var(--paper-deep); }
.picker-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.picker-text strong { font-weight: 500; font-size: var(--text-base); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker-text small { color: var(--ink-3); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 1080px) {
  .studio { grid-template-columns: 1fr; height: auto; }
  .chat-col { height: 72vh; }
  .canvas-col { min-height: 70vh; }
  .start-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .sheet-grid, .cover-tab { grid-template-columns: 1fr; }
  .composer-actions .hint { display: none; }
  .canvas-body { padding: 16px; }
  .canvas-head { flex-wrap: wrap; row-gap: 4px; }
  /* keep shot columns readable; the table scrolls sideways inside its frame */
  .shots-table.editable { min-width: 640px; }
}
