/* 剧本编辑器 / 剧本广场 */
.editor-wrap { background: #f4f6fb; min-height: calc(100vh - 68px); }
.ed-top { position: sticky; top: 68px; z-index: 20; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
    background: #fff; border-bottom: 1px solid #e8eaf3; padding: 10px 24px; }
.ed-top-left, .ed-top-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ed-back { color: #666; font-size: 18px; padding: 4px 6px; }
.ed-title { font-size: 20px; font-weight: 700; border: none; border-bottom: 2px dashed transparent; padding: 4px 2px; min-width: 260px; color: var(--dark-color); background: transparent; }
.ed-title:focus { outline: none; border-color: #c9cbfb; }
.ed-meta { font-size: 13px; color: #888; }
.save-status { font-size: 13px; padding: 2px 10px; border-radius: 12px; background: #eef7f1; color: #1e7e4a; }
.save-status.pending { background: #fff8e6; color: #a86b00; }
.save-status.err { background: #fdecec; color: #c0392b; }
.kind-badge { font-size: 12px; padding: 3px 10px; border-radius: 12px; color: #fff; background: var(--primary-color); white-space: nowrap; }
.kind-badge.k-comic { background: #e67e22; }
.kind-badge.k-storyboard { background: #16a085; }
.ed-body { display: grid; grid-template-columns: 300px 1fr; gap: 20px; padding: 20px 24px 60px; max-width: 1500px; margin: 0 auto; }
.ed-side { background: #fff; border-radius: 12px; padding: 16px; align-self: start; position: sticky; top: 140px; max-height: calc(100vh - 160px); overflow: auto; box-shadow: 0 2px 10px rgba(0, 30, 61, .05); }
.ed-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.ed-tab { flex: 1; padding: 7px; border: 1px solid #e3e5f5; background: #fafbff; border-radius: 8px; cursor: pointer; color: #555; }
.ed-tab.active { border-color: var(--primary-color); color: var(--primary-color); background: #f1f1ff; font-weight: 600; }
.ed-pane label { display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: 13px; color: #444; margin: 12px 0 6px; }
.ed-pane input, .ed-pane textarea { width: 100%; border: 1px solid #e0e3ef; border-radius: 6px; padding: 7px 9px; font: inherit; font-size: 14px; resize: vertical; }
.char-row { position: relative; border: 1px solid #eef0f8; border-radius: 8px; padding: 8px; margin-bottom: 8px; background: #fafbff; }
.char-row .c-name { font-weight: 600; margin-bottom: 6px; }
.char-row .c-del { position: absolute; top: 4px; right: 4px; }
.icon-btn { background: none; border: none; color: #aaa; cursor: pointer; padding: 4px 6px; border-radius: 4px; }
.icon-btn:hover { color: #c0392b; background: #fdf0f0; }
.chip { border: 1px solid #dcdff5; background: #f7f8ff; color: var(--primary-color); border-radius: 14px; padding: 3px 10px; font-size: 12px; cursor: pointer; font-weight: 500; }
.chip:hover { background: #eef0ff; }
.help-list { padding-left: 18px; font-size: 13px; line-height: 1.8; color: #555; margin-bottom: 14px; }
.help-list.keys { list-style: none; padding-left: 0; }
.ed-pane h4 { font-size: 14px; margin: 6px 0; color: var(--dark-color); }
kbd { background: #f1f2f6; border: 1px solid #d8dbe6; border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; font-size: 12px; font-family: inherit; }
.ed-main { min-width: 0; }

/* 剧本纸面 */
.sp-toolbar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.sp-toolbar .hint { margin-left: auto; font-size: 12px; color: #999; }
.sp-paper, .script-paper { background: #fff; max-width: 820px; margin: 0 auto; padding: 50px 70px; box-shadow: 0 4px 20px rgba(0, 30, 61, .08); border-radius: 4px;
    font-family: "Courier New", "Noto Serif SC", "Songti SC", serif; counter-reset: scene; }
.sp-block { position: relative; display: flex; align-items: flex-start; margin: 2px 0; }
.sp-block .sp-tag { position: absolute; left: -62px; top: 6px; width: 52px; text-align: right; font-size: 11px; color: #b6b9cc; cursor: pointer; font-family: system-ui, sans-serif; user-select: none; }
.sp-block:focus-within .sp-tag { color: var(--primary-color); font-weight: 600; }
.sp-block .sp-text { flex: 1; border: none; resize: none; font: inherit; font-size: 15px; line-height: 1.7; padding: 3px 4px; background: transparent; border-radius: 3px; overflow: hidden; }
.sp-block .sp-text:focus { outline: none; background: #f7f8ff; }
.sp-block .sp-del { position: absolute; right: -36px; top: 3px; opacity: 0; }
.sp-block:hover .sp-del, .sp-block:focus-within .sp-del { opacity: 1; }
.sp-block.t-scene { margin-top: 22px; counter-increment: scene; }
.sp-block.t-scene::before { content: counter(scene) "."; position: absolute; left: 4px; top: 5px; font-weight: 700; color: #333; font-size: 15px; }
.sp-block.t-scene .sp-text { padding-left: 30px; }
.sp-block.t-scene .sp-text { font-weight: 700; }
.sp-block.t-action .sp-text { }
.sp-block.t-character { margin-top: 12px; }
.sp-block.t-character .sp-text { text-align: center; font-weight: 700; margin: 0 32%; }
.sp-block.t-paren .sp-text { text-align: center; font-style: italic; margin: 0 30%; color: #555; }
.sp-block.t-dialogue .sp-text { margin: 0 18%; }
.sp-block.t-transition { margin: 12px 0; }
.sp-block.t-transition .sp-text { text-align: right; font-weight: 700; }

/* 漫画脚本 */
.cm-page { background: #fff; border-radius: 12px; padding: 18px 20px; margin-bottom: 18px; box-shadow: 0 2px 10px rgba(0, 30, 61, .05); }
.cm-page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.cm-page-head h3 { font-size: 18px; color: var(--dark-color); }
.cm-page-head small { font-size: 13px; color: #999; font-weight: normal; margin-left: 6px; }
.cm-note { width: 100%; border: 1px dashed #dde0ee; border-radius: 6px; padding: 6px 10px; font-size: 13px; margin-bottom: 10px; background: #fcfcff; }
.cm-warn { font-size: 12px; color: #a86b00; background: #fff8e6; border-radius: 6px; padding: 6px 10px; margin-bottom: 10px; }
.cm-panel { border: 1px solid #eceef7; border-left: 4px solid #c9cbfb; border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; }
.cm-panel-head { display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: var(--accent-color); margin-bottom: 6px; }
.cm-desc { width: 100%; border: 1px solid #e0e3ef; border-radius: 6px; padding: 8px 10px; font: inherit; font-size: 14px; line-height: 1.6; resize: none; overflow: hidden; background: #fafbff; }
.cm-lines { margin-top: 8px; }
.cm-line { display: grid; grid-template-columns: 82px 120px 1fr 30px; gap: 6px; margin-bottom: 6px; align-items: center; }
.cm-line select, .cm-line input { border: 1px solid #e0e3ef; border-radius: 6px; padding: 6px 8px; font: inherit; font-size: 14px; min-width: 0; }
.cm-line.t-sfx .cm-x { font-weight: 700; color: #c0392b; }
.cm-line.t-caption .cm-x { background: #fffbea; }
.cm-line.t-thought .cm-x { font-style: italic; }
.cm-add-lines { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.cm-add-page-btn { display: block; margin: 0 auto; }

/* 分镜表 */
.sb-wrap { background: #fff; border-radius: 12px; overflow-x: auto; box-shadow: 0 2px 10px rgba(0, 30, 61, .05); }
.sb-table { width: 100%; border-collapse: collapse; min-width: 1150px; font-size: 13px; }
.sb-table th { background: #f4f6fb; color: #555; font-weight: 600; padding: 10px 6px; text-align: left; white-space: nowrap; position: sticky; top: 0; }
.sb-table td { border-top: 1px solid #f0f1f6; padding: 6px; vertical-align: top; }
.sb-table td.no { font-weight: 700; color: var(--accent-color); text-align: center; width: 40px; padding-top: 12px; }
.sb-table input, .sb-table select, .sb-table textarea { width: 100%; border: 1px solid #e6e8f2; border-radius: 5px; padding: 5px 6px; font: inherit; font-size: 13px; resize: none; overflow: hidden; background: #fff; }
.sb-table td:nth-child(2) { width: 56px; } .sb-table td:nth-child(3) { width: 82px; } .sb-table td:nth-child(4) { width: 96px; }
.sb-table td:nth-child(6), .sb-table td:nth-child(7) { width: 22%; } .sb-table td:nth-child(8) { width: 70px; }
.sb-table td.img { width: 130px; position: relative; }
.sb-table td.img img { width: 120px; border-radius: 4px; display: block; border: 1px solid #eee; }
.sb-table td.img .icon-btn { position: absolute; top: 4px; right: 4px; background: rgba(255,255,255,.9); }
.sb-img-up { width: 120px; height: 68px; border: 1.5px dashed #cfd3e6; border-radius: 6px; background: #fafbff; color: #9aa0bd; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px; }
.sb-img-up:hover { border-color: var(--primary-color); color: var(--primary-color); }
.sb-table td.ops { white-space: nowrap; width: 90px; }
.sb-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; font-size: 14px; color: #666; }

/* 发布弹窗 */
.publish-modal { max-width: 480px; text-align: left; }
.publish-modal h3 { text-align: center; }
.pub-check { display: flex; gap: 8px; align-items: center; margin: 10px 0; font-weight: 600; cursor: pointer; }
.role-picks { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chip-check { display: inline-flex; align-items: center; gap: 4px; border: 1px solid #dcdff5; border-radius: 14px; padding: 3px 10px; font-size: 13px; cursor: pointer; }
.chip-check:has(input:checked) { background: #eef0ff; border-color: var(--primary-color); color: var(--primary-color); }
.publish-modal textarea, .apply-form textarea, .apply-form input, .apply-form select { width: 100%; border: 1px solid #e0e3ef; border-radius: 6px; padding: 8px; font: inherit; font-size: 14px; }

/* 阅读页 */
.script-view { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: start; }
.script-paper { padding: 50px 60px; }
.script-paper h1 { text-align: center; font-size: 26px; margin-bottom: 6px; font-family: inherit; }
.script-paper .byline { text-align: center; color: #777; margin-bottom: 30px; font-size: 14px; }
.sv-scene { font-weight: 700; margin-top: 22px; counter-increment: scene; }
.sv-scene::before { content: counter(scene) ". "; }
.sv-action { margin: 6px 0; white-space: pre-wrap; line-height: 1.8; }
.sv-character { text-align: center; font-weight: 700; margin-top: 14px; }
.sv-paren { text-align: center; font-style: italic; color: #555; }
.sv-dialogue { margin: 0 18%; white-space: pre-wrap; line-height: 1.8; }
.sv-transition { text-align: right; font-weight: 700; margin: 12px 0; }
.sv-page { margin-bottom: 26px; }
.sv-page h3 { font-size: 17px; border-bottom: 2px solid #333; padding-bottom: 4px; margin-bottom: 8px; font-family: inherit; }
.sv-page .note { color: #777; font-size: 14px; margin-bottom: 8px; }
.sv-panel { margin: 10px 0 14px; }
.sv-panel .pn { font-weight: 700; }
.sv-panel .desc { white-space: pre-wrap; line-height: 1.8; margin: 4px 0 6px; }
.sv-line { margin-left: 2em; line-height: 1.8; }
.sv-line .who { font-weight: 700; }
.sv-line.t-sfx .x { font-weight: 700; }
.sv-table { width: 100%; border-collapse: collapse; font-size: 13px; font-family: system-ui, sans-serif; }
.sv-table th, .sv-table td { border: 1px solid #ccc; padding: 6px; vertical-align: top; text-align: left; white-space: pre-wrap; }
.sv-table th { background: #f4f4f4; }
.sv-table img { width: 140px; display: block; }
.script-paper.wide { max-width: none; padding: 30px; }
.side-card { background: #fff; border-radius: 12px; padding: 18px; margin-bottom: 16px; box-shadow: 0 2px 10px rgba(0, 30, 61, .05); font-size: 14px; }
.side-card h3 { font-size: 16px; margin-bottom: 10px; color: var(--dark-color); }
.side-card .muted { color: #888; font-size: 13px; }
.member { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.member img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.app-item { border-top: 1px solid #f0f0f5; padding: 10px 0; }
.app-item .acts { display: flex; gap: 6px; margin-top: 6px; }
.app-item form { display: inline; }
.role-tag { font-size: 12px; background: #eef0ff; color: var(--primary-color); padding: 1px 8px; border-radius: 10px; }
.seek-tag { font-size: 12px; background: #fff3d6; color: #a86b00; padding: 2px 8px; border-radius: 10px; }

/* 剧本广场 */
.square-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 20px; }
.square-filters a { padding: 5px 14px; border-radius: 16px; border: 1px solid #e3e5f5; color: #555; font-size: 14px; background: #fff; }
.square-filters a.active { background: var(--primary-color); color: #fff; border-color: var(--primary-color); }
.square-filters form { margin-left: auto; display: flex; gap: 6px; }
.square-filters input { border: 1px solid #e0e3ef; border-radius: 16px; padding: 5px 14px; }
.script-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.script-card { background: #fff; border-radius: 12px; padding: 18px; box-shadow: 0 2px 10px rgba(0, 30, 61, .06); display: flex; flex-direction: column; gap: 8px; color: inherit; transition: var(--transition); border: 1px solid transparent; }
.script-card:hover { border-color: #c9cbfb; transform: translateY(-2px); }
.script-card h3 { font-size: 17px; color: var(--dark-color); }
.script-card .logline { color: #555; font-size: 14px; line-height: 1.6; flex: 1; }
.script-card .meta { font-size: 12px; color: #999; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.tool-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 24px; margin-bottom: 30px; }
.tool-card { background: #fff; border-radius: 16px; padding: 30px; box-shadow: 0 6px 24px rgba(0, 30, 61, .08); display: flex; flex-direction: column; gap: 12px; }
.tool-card .ticon { width: 56px; height: 56px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 26px; color: #fff; background: linear-gradient(135deg, #6566fa, #0032a3); }
.tool-card.t2 .ticon { background: linear-gradient(135deg, #f0a30b, #e67e22); }
.tool-card h2 { font-size: 22px; color: var(--dark-color); }
.tool-card p { color: #666; line-height: 1.7; }
.tool-card .actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: auto; }
.kind-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kind-pick button { border: 1.5px solid #e3e5f5; background: #fafbff; border-radius: 10px; padding: 12px 6px; cursor: pointer; font-size: 14px; color: #333; }
.kind-pick button:hover { border-color: var(--primary-color); background: #f1f1ff; }
.kind-pick button small { display: block; color: #999; font-size: 12px; margin-top: 2px; }
@media (max-width: 900px) {
    .ed-body, .script-view { grid-template-columns: 1fr; }
    .ed-side { position: static; max-height: none; }
    .sp-paper, .script-paper { padding: 30px 20px 30px 70px; }
    .kind-pick { grid-template-columns: 1fr; }
}
@media print {
    header, footer, .side-col, .no-print, .back-to-top, .messages { display: none !important; }
    .script-view { display: block; }
    .script-paper { box-shadow: none; padding: 0; max-width: none; }
    body { background: #fff; }
    .sv-page { page-break-inside: avoid; }
}
