:root {
  color-scheme: light;
  --ink: #242a2c; --muted: #727c80; --line: #dfe5e7; --paper: #fff;
  --bg: #f5f7f8; --accent: #087f72; --soft: #e8f4f1; --danger: #b34343;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px; color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; letter-spacing: 0; }
body { margin: 0; }
button, input, textarea, select { font: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button, .icon {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 8px 14px; border: 1px solid #d6dfe1;
  border-radius: 6px; background: var(--paper); color: var(--ink);
  font-size: 13px; font-weight: 500; line-height: 1.5; cursor: pointer; text-decoration: none;
  transition: background .16s, border-color .16s, box-shadow .16s, transform .16s;
}
button:hover, .icon:hover { background: #f0f5f5; border-color: #a7bcba; box-shadow: 0 2px 5px #1b353509; }
button:active, .icon:active { transform: translateY(1px); }
button:focus-visible, a:focus-visible { outline: 3px solid #57bbae; outline-offset: 3px; }
button:disabled { opacity: .42; cursor: not-allowed; box-shadow: none; transform: none; }
.primary { background: var(--accent); border-color: var(--accent); color: white; box-shadow: 0 2px 4px #087f721a; }
.primary:hover { background: #076c62; border-color: #076c62; color: white; box-shadow: 0 3px 8px #087f7226; }
.icon { width: 36px; min-height: 36px; padding: 8px; flex-shrink: 0; }
svg { width: 16px; height: 16px; flex-shrink: 0; stroke-width: 1.7; }
input, textarea, select {
  width: 100%; min-height: 42px; padding: 10px 12px; border: 1px solid #d8e0e2;
  border-radius: 6px; background: #fff; color: var(--ink); font-weight: 400;
  transition: border-color .16s, box-shadow .16s;
}
input:hover, textarea:hover, select:hover { border-color: #b5c5c7; }
input:focus, textarea:focus, select:focus { outline: none; border-color: #369e92; box-shadow: 0 0 0 3px #087f7210; }
input:disabled, textarea:disabled, select:disabled { color: #6d797c; background: #f6f8f8; }
input::placeholder, textarea::placeholder { color: #9ba5a8; }
textarea { line-height: 1.85; resize: vertical; }
label { display: grid; gap: 9px; font-size: 12px; font-weight: 600; color: #505b60; }
label input, label textarea, label select { font-size: 14px; }
input[type=checkbox] { accent-color: var(--accent); border-radius: 3px; }
small { color: var(--muted); font-size: 11px; font-weight: 400; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 17px; font-weight: 600; white-space: nowrap; }
h2 { font-size: 26px; font-weight: 600; line-height: 1.4; }
h3 { font-size: 15px; font-weight: 550; }
.app-header {
  height: 68px; display: flex; align-items: center; gap: 12px; padding: 0 24px;
  background: #1c2125; color: #f3f6f7; border-bottom: 1px solid #333b40;
}
.app-header img { width: 30px; height: 30px; border-radius: 7px; }
.app-header > .icon { color: #b4c0c5; border-color: #3a444a; background: transparent; margin-right: 5px; }
.app-header .icon:hover { color: white; background: #333d43; }
.badge { font-size: 10px; font-weight: 500; padding: 3px 6px; border: 1px solid #60604d; border-radius: 4px; color: #d9c68f; background: #bca3630c; }
.project-tools { display: flex; align-items: center; margin-left: auto; gap: 9px; }
.project-tools select { width: 238px; min-height: 35px; padding: 7px 10px; color: #d0d9dd; border-color: #40494f; background: #252d32; color-scheme: dark; font-size: 12px; }
.project-tools button { min-height: 35px; white-space: nowrap; background: #e9eeec; color: #242f2e; border-color: #e9eeec; }
.project-tools button:hover { background: white; }
.app-shell { display: grid; grid-template-columns: 218px minmax(0, 1fr); min-height: calc(100vh - 68px); }
.sidebar { display: flex; flex-direction: column; gap: 20px; padding: 32px 15px 24px; background: #242a2e; color: #adb6bb; border-right: 1px solid #343c41; }
.nav-label { padding-left: 14px; color: #8b999f; font-size: 10px; font-weight: 600; }
.sidebar nav { display: grid; gap: 9px; }
.sidebar nav button { position: relative; justify-content: flex-start; min-height: 46px; padding: 11px 13px; gap: 11px; background: transparent; border: 1px solid transparent; color: #b9c4c8; font-size: 13px; font-weight: 400; }
.sidebar nav button span { order: 3; margin-left: auto; color: #87959d; font: 11px ui-monospace, SFMono-Regular, Menlo, monospace; }
.sidebar nav button:hover { background: #30393e; color: white; box-shadow: none; }
.sidebar nav button.active { background: #314940; border-color: #47665b; color: #dcf4e8; box-shadow: 0 2px 8px #00000010; }
.sidebar nav button.active span { color: #a5d4bd; }
.sidebar nav button.complete:not(.active) { color: #c9ded4; }
.sidebar nav button.complete span::after { content: ""; display: inline-block; width: 5px; height: 8px; margin-left: 5px; border-right: 1px solid #81b6a0; border-bottom: 1px solid #81b6a0; transform: rotate(40deg) translateY(-1px); }
.project-meta { margin: 6px 9px 0; padding-top: 23px; border-top: 1px solid #3a4348; color: #9cabb2; font-size: 12px; line-height: 1.9; overflow-wrap: anywhere; }
.cost { margin: auto 9px 0; padding-top: 24px; border-top: 1px solid #3a4348; font-size: 11px; line-height: 2.2; color: #a4b0b7; }
.cost strong { display: block; color: #e1e8e6; font-size: 15px; font-weight: 500; }
.cost small { display: block; color: #a0adb4; font-size: 10px; }
main { width: 100%; max-width: 1530px; min-width: 0; margin: 0 auto; padding: 34px 40px 44px; }
.heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 28px; padding-bottom: 23px; border-bottom: 1px solid var(--line); }
.step-index { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; color: var(--accent); font: 11px ui-monospace, SFMono-Regular, Menlo, monospace; }
.step-index span { color: #a2acb0; }
.heading p { margin-top: 7px; color: var(--muted); font-size: 12px; }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.input-layout { display: grid; grid-template-columns: minmax(0, 1fr) 258px; gap: 34px; }
.fields { display: grid; gap: 20px; min-width: 0; }
.source-fields { gap: 19px; }
.style-picker { display: grid; gap: 10px; }
.style-picker-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; color: #33484a; }
.style-picker-head strong { font-size: 13px; }.style-picker-head span { margin-left: 9px; color: #879496; font-size: 10px; font-weight: 400; }.style-count { margin-left: auto !important; color: #9b7650 !important; font-family: ui-monospace, monospace; }
.style-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.style-card { position: relative; display: grid; grid-template-rows: 104px auto; overflow: hidden; min-width: 0; border: 1px solid #dbe3e4; border-radius: 6px; background: #fff; cursor: pointer; transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease; }
.style-card:hover { transform: translateY(-2px); border-color: #a77a4b; box-shadow: 0 8px 20px #233b3d12; }.style-card.selected { border-color: #ad7544; box-shadow: 0 0 0 2px #ad754433; }
.style-card input { position: absolute; width: 1px; height: 1px; opacity: 0; }.style-thumb { position: relative; overflow: hidden; background: #161616; }.style-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 25%; }.style-thumb span { position: absolute; left: 7px; bottom: 6px; padding: 3px 5px; color: #f8eee1; background: #131b22b8; border: 1px solid #ffffff33; border-radius: 3px; font-size: 9px; }
.style-card[hidden] { display: none; }.style-card:has(input:focus-visible) { outline: 2px solid #e8bd80; outline-offset: 2px; }
.style-thumb .style-selected { display: none; left: auto; bottom: auto; right: 6px; top: 6px; padding: 3px; color: #171717; background: #e5c08a; border: 0; }.style-selected svg { display: block; width: 14px; height: 14px; }.style-card.selected .style-selected { display: block; }
.style-tools { display: flex; align-items: center; gap: 7px; }.style-tools select { width: 132px; min-height: 30px; padding: 5px 7px; font-size: 11px; }.style-tools .icon { width: 30px; min-height: 30px; }.style-grid { max-height: 420px; grid-auto-rows: 180px; align-content: start; overflow-y: auto; padding: 3px; scrollbar-gutter: stable; }
.style-card-copy { display: grid; gap: 4px; padding: 8px 9px 10px; }.style-card-copy strong { overflow: hidden; color: #2c3a3e; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }.style-card-copy p { display: -webkit-box; overflow: hidden; margin: 0; color: #7b898d; font-size: 9px; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.novel-input { min-height: 300px; padding: 16px; line-height: 1.95; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.source-toolbar { display: flex; align-items: center; justify-content: space-between; margin-top: -10px; color: #7b898e; font: 11px ui-monospace, SFMono-Regular, Menlo, monospace; }
.source-toolbar button { min-height: 30px; padding: 5px 9px; font-size: 11px; border-color: transparent; background: transparent; color: #65797c; }
.source-toolbar button:hover { background: #e8eeef; }
.source-toolbar svg { width: 13px; height: 13px; }
.check { display: flex; align-items: flex-start; gap: 9px; font-size: 12px; line-height: 1.8; font-weight: 400; color: #6c767a; }
.check input { width: 15px; min-height: 15px; margin: 3px 0 0; padding: 0; flex-shrink: 0; }
.source-fields > .actions { padding-top: 3px; }
.source-fields > .actions .primary { min-height: 42px; padding: 10px 18px; }
.section-title { display: flex; align-items: center; justify-content: space-between; color: #738287; font-size: 11px; font-weight: 600; }
.section-title svg { order: 2; width: 14px; height: 14px; color: #869798; }
.outline { align-self: start; border-left: 1px solid var(--line); padding: 2px 0 0 28px; }
.spec-total { display: flex; align-items: baseline; gap: 9px; margin: 30px 0 25px; }
.spec-total strong { color: #283d3c; font: 44px ui-monospace, SFMono-Regular, Menlo, monospace; line-height: 1; font-weight: 400; }
.spec-total span { font-size: 12px; color: #7d8a8f; }
.spec-total svg { margin-left: auto; align-self: center; width: 24px; height: 24px; stroke-width: 1; color: #8ba39d; }
.spec-list { margin: 0; padding: 0; }
.spec-list > div { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 15px 0; border-top: 1px solid #e5eaec; font-size: 12px; }
.spec-list dt { color: #7f8a8f; }.spec-list dd { margin: 0; color: #435254; font-variant-numeric: tabular-nums; text-align: right; }
.estimate { margin-top: 24px; padding: 19px 0; border-top: 1px solid #c5d6d1; }
.estimate > div { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 12px; color: #6e7e7e; }
.estimate strong { font-weight: 400; color: var(--accent); font-size: 11px; white-space: nowrap; }
.estimate b { font: 20px ui-monospace, SFMono-Regular, Menlo, monospace; }
.estimate small { display: block; margin-top: 12px; font-size: 10px; color: #8a9699; }
.source-read { max-height: 570px; overflow: auto; white-space: pre-wrap; padding: 24px; background: white; border: 1px solid var(--line); border-radius: 6px; line-height: 2; }
.character-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.character { overflow: hidden; background: white; border: 1px solid #dbe2e4; border-radius: 8px; box-shadow: 0 3px 12px #20303804; }
.character-fields { display: grid; gap: 14px; padding: 18px; }
.character-fields textarea { min-height: 100px; font-size: 13px; }
.image-slot { position: relative; overflow: hidden; aspect-ratio: 2/3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: #edf1f2; color: #8a9b9f; }
.image-slot::after { content: ""; position: absolute; inset: 12px; border: 1px solid #bccacd55; border-radius: 3px; pointer-events: none; }
.image-slot:has(img)::after { display: none; }
.image-slot > svg { width: 30px; height: 30px; stroke-width: 1.2; }
.image-slot img { width: 100%; height: 100%; object-fit: contain; cursor: zoom-in; background: #eceff0; }
.character .image-slot { aspect-ratio: 4/3; border-bottom: 1px solid #dfe5e7; }
.summary { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 25px; }.summary textarea { min-height: 110px; }
.bottom-bar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 27px; padding: 20px 0; border-top: 1px solid var(--line); }
.bottom-bar p { color: var(--muted); font-size: 12px; line-height: 1.8; }
.status { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 22px; padding: 13px 16px; color: #226659; background: #edf7f3; border: 1px solid #c6e2d7; border-left: 3px solid #54a18c; border-radius: 5px; font-size: 12px; line-height: 1.8; }
.status.error { color: #954c37; background: #fff3ed; border-color: #ecd2c4; border-left-color: #c08b62; }.status .actions { flex-shrink: 0; }
.board-list { display: grid; gap: 24px; }
.panel-editor { display: grid; grid-template-columns: 44px minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px; padding: 0 0 25px; border-bottom: 1px solid var(--line); }
.panel-index { padding-top: 3px; color: #87989d; font: 18px ui-monospace, SFMono-Regular, Menlo, monospace; }
.panel-editor .fields { gap: 13px; }.panel-editor textarea { min-height: 100px; }
.cast { display: flex; gap: 14px; flex-wrap: wrap; }.cast label { font-weight: 400; font-size: 12px; }.cast input { width: 15px; min-height: 15px; }
.comic-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.comic-card { min-width: 0; overflow: hidden; background: white; border: 1px solid #dce3e6; border-radius: 7px; transition: border-color .18s, box-shadow .18s; }
.comic-card:hover { border-color: #9cb8b4; box-shadow: 0 4px 16px #2339360a; }
.card-footer { display: grid; gap: 13px; padding: 16px; border-top: 1px solid #e1e7e8; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }.card-title strong { font-size: 12px; font-weight: 550; }.card-title span { color: var(--muted); font-size: 10px; }
.card-footer button { font-size: 11px; min-height: 33px; padding: 6px 9px; }
.empty { display: grid; align-content: center; justify-items: center; gap: 20px; min-height: 370px; color: #7b898f; text-align: center; }
.empty > svg { width: 40px; height: 40px; stroke-width: 1; color: #8fa7a2; }.empty p { max-width: 420px; font-size: 13px; line-height: 1.8; }
.version-picker { min-height: 33px; padding: 6px 8px; background: #f8fafb; font-size: 11px; color: #75858c; }
.hidden, [hidden] { display: none !important; }
.toast { position: fixed; bottom: 25px; left: 50%; z-index: 1000; transform: translateX(-50%); max-width: min(580px, calc(100vw - 32px)); padding: 13px 19px; background: #273634; color: white; border: 1px solid #4d6961; border-radius: 6px; font-size: 13px; line-height: 1.7; box-shadow: 0 8px 32px #10201b26; }
dialog { max-width: min(540px, calc(100vw - 28px)); padding: 27px; background: #fff; color: var(--ink); border: 1px solid #b8cbc5; border-radius: 8px; box-shadow: 0 24px 80px #0003; }
dialog::backdrop { background: #141c22a8; backdrop-filter: blur(5px); }
dialog h2 { font-size: 20px; }dialog p { margin: 18px 0 25px; color: var(--muted); font-size: 13px; line-height: 1.9; }
#imageDialog { max-width: min(1000px, calc(100vw - 24px)); padding: 14px; background: #f1f4f5; }#largeImage { display: block; max-height: 80vh; max-width: 100%; margin: auto; }
.dialog-bar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 10px; font-size: 12px; }
.task-note { font-size: 11px; color: #8f6260; line-height: 1.7; }.unsaved { color: #a37740; font-size: 11px; }
@media (min-width: 1600px) { .comic-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 186px minmax(0, 1fr); }main { padding: 28px; }
  .input-layout { grid-template-columns: minmax(0, 1fr) 210px; gap: 23px; }.outline { padding-left: 20px; }
  .character-grid, .comic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .input-layout { grid-template-columns: 1fr; }.outline { display: none; }
  .panel-editor { grid-template-columns: 30px minmax(0, 1fr); }.panel-editor > .fields:last-child { grid-column: 2; }
}
@media (max-width: 720px) {
  input, textarea, select, label input, label textarea, label select { font-size: 16px; }
  .app-header { height: auto; flex-wrap: wrap; gap: 9px; padding: 13px 16px; }.app-header h1 { font-size: 16px; }.app-header .badge { margin-left: auto; }
  .app-header img { width: 28px; height: 28px; }.project-tools { width: 100%; margin-left: 0; margin-top: 4px; }.project-tools select { flex: 1; min-width: 0; width: auto; font-size: 16px; }
  .app-shell { display: block; }.sidebar { padding: 8px 9px; border-right: 0; border-bottom: 1px solid #3f4a4f; }.sidebar nav { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
  .sidebar nav button { flex-direction: column; gap: 5px; padding: 9px 1px; min-height: 57px; font-size: 11px; }.sidebar nav button span, .nav-label, .project-meta, .cost { display: none; }
  main { padding: 25px 18px 32px; }.heading { flex-wrap: wrap; align-items: flex-start; gap: 16px; margin-bottom: 23px; padding-bottom: 20px; }h2 { font-size: 23px; }.step-index { margin-bottom: 7px; }
  .novel-input { min-height: 310px; padding: 13px; }.source-fields { gap: 18px; }.field-row { gap: 13px; }.source-toolbar { margin-top: -9px; }
  .character-grid, .summary { grid-template-columns: 1fr; }.character .image-slot { aspect-ratio: 1/1; }.character-fields textarea { font-size: 16px; }
  .comic-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }.card-footer { padding: 10px; gap: 10px; }.card-footer .actions { gap: 6px; }.card-footer button { padding: 6px; font-size: 10px; }.card-footer button svg { width: 13px; }
  .card-title { flex-wrap: wrap; gap: 5px; }.card-title strong { font-size: 11px; }.version-picker { font-size: 16px; }
  .bottom-bar, .status { align-items: flex-start; flex-direction: column; }.bottom-bar { gap: 15px; }.panel-editor { gap: 10px; grid-template-columns: 24px minmax(0, 1fr); }.panel-index { font-size: 16px; }.source-read { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* V2: keep the working surface dense while giving page-level story structure a clear rhythm. */
.field-hint { min-height: 18px; margin-top: -12px; color: #738b82; font-size: 11px; }
.optional { color: #9aa5a8; font-size: 10px; font-weight: 400; }
.coverage, .legacy-notice { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; padding: 12px 15px; border: 1px solid #d7e3df; background: #f1f7f5; color: #3c665d; border-radius: 5px; font-size: 12px; line-height: 1.7; }
.coverage ul { display: flex; flex-wrap: wrap; gap: 5px 20px; margin: 0; padding-left: 20px; }
.legacy-notice { border-color: #e4d7c7; background: #fbf6ef; color: #785c3e; }
.legacy-notice button { min-height: 31px; padding: 5px 10px; font-size: 11px; }
.generation-bar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 24px; padding: 15px 17px; border: 1px solid #d3e2de; border-left: 3px solid #6eaa98; background: #f3f8f6; border-radius: 5px; }
.generation-bar p { margin: 0; color: #355b52; font-size: 13px; }.generation-bar small { color: #79908a; font-size: 11px; }
.generation-bar .actions { justify-content: flex-end; }.generation-bar button { min-height: 34px; padding: 6px 10px; font-size: 11px; }
.comic-card .image-slot { aspect-ratio: 3 / 4; }
.page-editor { padding: 20px 0 29px; border-bottom: 1px solid var(--line); }.page-editor:first-child { padding-top: 0; }
.page-header { display: grid; grid-template-columns: 180px minmax(0,1fr); gap: 24px; margin-bottom: 22px; }.page-layout { display: grid; grid-template-columns: 66px 1fr; gap: 11px; align-items: center; }.page-layout strong { grid-column: 2; font-size: 13px; font-weight: 550; }.page-layout span { grid-column: 2; margin-top: -6px; color: var(--muted); font-size: 11px; }
.page-settings { display: grid; gap: 13px; }.page-settings .field-row { gap: 13px; }.page-settings label { font-size: 11px; }
.layout-preview { position: relative; width: 66px; height: 88px; display: grid; gap: 2px; padding: 3px; background: #dce8e5; border: 1px solid #adc8c0; border-radius: 3px; }.layout-preview span { display: grid; place-items: center; min-width: 0; min-height: 0; color: #4b756a; background: #f8fbfa; font: 10px ui-monospace, monospace; }.layout-preview.two-rows { grid-template-rows: 1fr 1fr; }.layout-preview.three-rows { grid-template-rows: repeat(3,1fr); }.layout-preview.top-wide { grid-template-rows: 1.35fr 1fr; }.layout-preview.top-wide span:nth-child(1) { grid-column: 1 / -1; }.layout-preview.bottom-wide { grid-template-rows: 1fr 1.35fr; }.layout-preview.bottom-wide span:nth-child(3) { grid-column: 1 / -1; }.layout-preview.diagonal { transform: skewY(-9deg); grid-template-columns: 1fr 1fr; }.layout-preview.memory { grid-template-columns: 1fr 1fr; }.layout-preview.memory span:first-child { grid-row: 1 / 3; }
.panel-editor { grid-template-columns: 35px minmax(0,1fr) minmax(0,1fr); gap: 17px; padding: 17px 0; }.panel-editor:first-of-type { padding-top: 0; }.panel-source { min-height: 74px; color: #768487; background: #f2f5f5; font-size: 11px; line-height: 1.7; resize: vertical; }.panel-source[readonly] { border-style: dashed; cursor: default; }
.panel-texts { gap: 10px; padding: 13px; border: 1px solid #e0e7e6; background: #fafcfc; border-radius: 5px; }.panel-texts .section-title { margin-bottom: 1px; }.panel-texts .section-title span { color: #9aa5a8; font-size: 10px; font-weight: 400; }.text-list { display: grid; gap: 10px; }.text-editor { padding: 10px; border: 1px solid #e2e8e8; background: #fff; border-radius: 4px; }.text-tools { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)) 32px; gap: 6px; align-items: end; }.text-tools label { min-width: 0; color: #798689; font-size: 10px; }.text-tools select { min-height: 31px; padding: 5px 6px; font-size: 11px; }.text-tools .icon { width: 31px; min-height: 31px; padding: 5px; }.text-content { margin-top: 7px; color: #798689; font-size: 10px; }.text-content textarea { min-height: 54px; margin-top: 4px; padding: 7px 8px; font-size: 12px; line-height: 1.6; }
.page-pending { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 16px; border: 1px dashed #c9d6d5; color: #7b898f; }.page-pending h3 { margin: 0; font-size: 13px; font-weight: 550; }.page-pending p { margin: 0; font-size: 11px; }.page-pending .task-note { margin-left: auto; }
.task-note { margin: 0; color: #798b8a; font-size: 10px; line-height: 1.7; }.task-note.failed, .failed { color: #965f50; }.review-note { display: flex; align-items: center; gap: 5px; margin: 0; color: #8b704e; font-size: 10px; }.review-note svg { width: 13px; height: 13px; }
.legacy-board { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 15px; }.legacy-board article { padding: 16px; border: 1px solid var(--line); background: #fff; border-radius: 6px; }.legacy-board h3 { margin: 0 0 11px; font-size: 13px; }.legacy-board p { margin: 7px 0; color: #708084; font-size: 12px; line-height: 1.65; }
@media (max-width: 960px) { .page-header { grid-template-columns: 1fr; }.page-layout { grid-template-columns: 66px 1fr; }.page-settings { max-width: none; }.panel-editor { grid-template-columns: 28px minmax(0,1fr); }.panel-texts { grid-column: 2; }.generation-bar { align-items: flex-start; flex-direction: column; }.generation-bar .actions { justify-content: flex-start; }.legacy-board { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 720px) { .coverage, .legacy-notice { align-items: flex-start; flex-direction: column; }.coverage ul { display: block; }.generation-bar .actions { width: 100%; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }.generation-bar .actions button:last-child { grid-column: 1 / -1; }.page-header { gap: 15px; }.page-layout { grid-template-columns: 56px 1fr; }.layout-preview { width: 56px; height: 75px; }.page-settings .field-row { grid-template-columns: 1fr; }.text-tools { grid-template-columns: repeat(2,minmax(0,1fr)) 32px; }.text-tools label:nth-child(3), .text-tools label:nth-child(4) { grid-row: 2; }.text-tools .icon { grid-column: 3; grid-row: 1 / 3; align-self: center; }.legacy-board { grid-template-columns: 1fr; } }

/* Premium dark workspace: tighter geometry, higher contrast, more visible work area. */
:root {
  color-scheme: dark;
  --ink: #e8edf1; --muted: #8d99a5; --line: #2c2c2c; --paper: #171717;
  --bg: #090909; --accent: #d4a35d; --soft: #17202a; --danger: #df7d79;
  font-size: 12px;
}
body { background: var(--bg); }
button, .icon { min-height: 33px; padding: 6px 11px; border-color: #343434; background: #171717; color: #dfe6eb; font-size: 11px; border-radius: 4px; }
button:hover, .icon:hover { background: #242424; border-color: #866a3f; box-shadow: 0 4px 16px #0008; }
.primary { background: #b37b35; border-color: #c4914a; color: #0b0d10; box-shadow: 0 4px 18px #b37b3526; }
.primary:hover { background: #d1a15f; border-color: #e2b46c; color: #0b0d10; }
input, textarea, select { min-height: 34px; padding: 7px 9px; border-color: #343434; background: #111111; color: var(--ink); border-radius: 4px; font-size: 12px; }
input:hover, textarea:hover, select:hover { border-color: #526274; }
input:focus, textarea:focus, select:focus { border-color: #c28b45; box-shadow: 0 0 0 2px #c28b4522; }
input:disabled, textarea:disabled, select:disabled { color: #66717c; background: #11161d; }
input::placeholder, textarea::placeholder { color: #596572; }
textarea { line-height: 1.55; }
label { gap: 6px; color: #aeb8c2; font-size: 11px; }
label input, label textarea, label select { font-size: 12px; }
h1 { font-size: 15px; } h2 { font-size: 21px; line-height: 1.25; } h3 { font-size: 13px; }
.app-header { height: 54px; gap: 9px; padding: 0 18px; background: #101010ef; border-bottom-color: #292929; backdrop-filter: blur(16px); }
.app-header img { width: 27px; height: 27px; border-radius: 6px; }
.app-header > .icon { margin-right: 2px; border-color: #313c49; color: #aab5bf; }
.badge { color: #e5bd80; border-color: #70572f; background: #c18b3914; }
.project-tools { gap: 6px; }
.project-tools select { width: 220px; min-height: 31px; padding: 5px 8px; background: #10161d; }
.project-tools button { min-height: 31px; background: #d3a05b; color: #0b0d10; border-color: #d3a05b; }
.project-tools button:hover { background: #e5b56d; }
.app-shell { grid-template-columns: 178px minmax(0, 1fr); min-height: calc(100vh - 54px); }
.sidebar { gap: 15px; padding: 24px 11px 17px; background: #101010; border-right-color: #282828; }
.nav-label { padding-left: 10px; color: #8d979f; font-size: 10px; }
.sidebar nav { gap: 5px; }
.sidebar nav button { min-height: 38px; padding: 8px 10px; gap: 8px; color: #8996a2; font-size: 11px; }
.sidebar nav button span { color: #566372; font-size: 10px; }
.sidebar nav button:hover { background: #141d27; color: #edf2f5; }
.sidebar nav button.active { background: #1d1c19; border-color: #755a32; color: #f1d4a3; box-shadow: inset 3px 0 #d1a15f; }
.sidebar nav button.active span { color: #d7a45e; }
.project-meta { margin: 4px 6px 0; padding-top: 17px; border-top-color: #282828; color: #74818e; font-size: 10px; line-height: 1.7; }
.cost { margin: auto 6px 0; padding-top: 17px; border-top-color: #282828; color: #73808c; line-height: 1.8; }
.cost strong { color: #d5b27c; font-size: 13px; }
main { max-width: 1720px; padding: 25px 30px 32px; }
.heading { gap: 18px; margin-bottom: 19px; padding-bottom: 16px; border-bottom-color: #2a2a2a; }
.step-index { margin-bottom: 7px; color: #d3a15b; font-size: 10px; }
.step-index span, .heading p { color: #72808d; } .heading p { margin-top: 5px; font-size: 11px; }
.actions { gap: 6px; }
.input-layout { grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; }
.style-picker { padding-top: 2px; }.style-picker-head { color: #c9d2d8; }.style-picker-head strong { color: #e7edf0; font-size: 11px; }.style-picker-head span { color: #74828e; }.style-card { grid-template-rows: 110px minmax(0,1fr); gap: 0; height: 180px; min-height: 180px; border-color: #333; background: #151515; }.style-card:hover { border-color: #967047; box-shadow: 0 8px 22px #0006; }.style-card.selected { border-color: #c28f52; box-shadow: 0 0 0 2px #c28f5238; }.style-card-copy { padding: 7px 8px 9px; }.style-card-copy strong { color: #e0e8eb; font-size: 11px; }.style-card-copy p { color: #929292; font-size: 10px; }.style-thumb span { color: #d7e0e5; background: #111820c9; }
.character .image-slot { aspect-ratio: 3 / 2; }
.fields { gap: 14px; } .source-fields { gap: 13px; align-content: start; } .field-row { gap: 12px; }
.novel-input { min-height: 245px; padding: 11px; line-height: 1.7; }
.source-toolbar { margin-top: -7px; color: #64717d; font-size: 10px; }
.source-toolbar button { min-height: 27px; padding: 4px 7px; color: #8d9aa5; }
.source-toolbar button:hover { background: #161f28; }
.source-import-actions { display: flex; align-items: center; gap: 4px; }
.source-import-actions button { display: inline-flex; align-items: center; gap: 5px; }
.source-import-actions svg { width: 13px; height: 13px; }
#zhihuDialog { width: min(560px, calc(100vw - 28px)); }
#zhihuDialog label { display: grid; gap: 7px; }
#zhihuDialog .actions { margin-top: 18px; }
.dialog-status { margin-top: 12px; padding: 8px 10px; border: 1px solid #3d4650; border-radius: 4px; color: #aebbc5; font-size: 11px; line-height: 1.6; }
.dialog-status.success { border-color: #3a6858; color: #a9d3c0; background: #12201c; }
.dialog-status.error { border-color: #704340; color: #e3aaa1; background: #251716; }
.check { gap: 7px; color: #82909d; font-size: 11px; line-height: 1.6; }
.check input { width: 13px; min-height: 13px; }
.outline { padding-left: 20px; border-left-color: #2a2a2a; }
.section-title { color: #83909c; font-size: 10px; }
.spec-total { margin: 21px 0 18px; } .spec-total strong { color: #ddb36e; font-size: 34px; }
.spec-list > div { padding: 10px 0; border-top-color: #282828; font-size: 10px; } .spec-list dt { color: #788692; } .spec-list dd { color: #ccd4da; }
.estimate { margin-top: 16px; padding: 14px 0; border-top-color: #664e30; } .estimate > div { font-size: 10px; } .estimate b { font-size: 17px; }
.source-read { max-height: 470px; padding: 17px; background: #111111; border-color: #303030; border-radius: 4px; line-height: 1.8; }
.character-grid, .comic-grid { gap: 13px; }
.character, .comic-card { background: #151515; border-color: #303030; border-radius: 5px; box-shadow: 0 8px 28px #0004; }
.character-fields { gap: 10px; padding: 13px; } .character-fields textarea { min-height: 78px; font-size: 11px; }
.image-slot { background: #0b0b0b; color: #64727f; } .image-slot img { background: #0b0b0b; }
.summary { gap: 13px; margin-bottom: 17px; } .summary textarea { min-height: 88px; }
.bottom-bar { gap: 14px; margin-top: 19px; padding: 15px 0; border-top-color: #2a2a2a; } .bottom-bar p { color: #7c8995; font-size: 10px; }
.status { gap: 11px; margin-bottom: 16px; padding: 10px 12px; color: #b9d7ce; background: #12201f; border-color: #2c564c; border-left-color: #c18f4f; font-size: 10px; }
.status.error { color: #e7aaa0; background: #241719; border-color: #653b38; border-left-color: #d37861; }
.coverage, .legacy-notice { gap: 13px; margin-bottom: 14px; padding: 9px 12px; border-color: #394530; background: #171c17; color: #b9ccae; border-radius: 4px; font-size: 10px; }
.legacy-notice { border-color: #55432f; background: #211b15; color: #d4b17e; }
.generation-bar { gap: 13px; margin-bottom: 17px; padding: 11px 13px; border-color: #394530; border-left-color: #c29352; background: #171c19; border-radius: 4px; }
.generation-bar p { color: #c7d4cd; font-size: 11px; } .generation-bar small { color: #81928c; font-size: 10px; }
.generation-bar { flex-wrap: wrap; }
.generation-bar .image-quality { display: flex; align-items: center; gap: 8px; margin: 0; color: #c7d4cd; font-size: 12px; white-space: nowrap; }
.generation-bar .image-quality select { width: 138px; min-height: 34px; padding: 6px 9px; }
@media (max-width: 720px) { .generation-bar .image-quality select { font-size: 16px; width: 155px; } }
.page-editor { padding: 16px 0 21px; border-bottom-color: #2a2a2a; } .page-header { grid-template-columns: 148px minmax(0,1fr); gap: 17px; margin-bottom: 16px; }
.page-layout { grid-template-columns: 56px 1fr; gap: 8px; } .page-layout strong { font-size: 11px; } .page-layout span { font-size: 10px; }
.layout-preview { width: 56px; height: 75px; background: #20252a; border-color: #66502f; } .layout-preview span { color: #c59a59; background: #151b21; }
.page-settings { gap: 10px; } .panel-editor { grid-template-columns: 28px minmax(0,1.15fr) minmax(0,1fr); gap: 13px; padding: 13px 0; }
.panel-index { color: #b5894e; font-size: 14px; } .panel-editor .fields { gap: 9px; } .panel-editor textarea { min-height: 82px; }
.panel-source { min-height: 62px; color: #82909b; background: #191919; border-color: #33404b; }
.panel-texts { gap: 8px; padding: 10px; border-color: #343434; background: #131313; } .text-list { gap: 8px; }
.text-editor { padding: 8px; border-color: #303030; background: #191919; } .text-tools { gap: 5px; } .text-tools label, .text-content { color: #7d8b97; } .text-tools select { min-height: 28px; padding: 4px 5px; font-size: 10px; } .text-content textarea { min-height: 45px; padding: 6px 7px; font-size: 11px; }
.page-pending { gap: 12px; padding: 12px; border-color: #4a3d2e; color: #7f8c98; } .page-pending h3 { font-size: 11px; } .page-pending p, .task-note { font-size: 10px; }
.card-footer { gap: 9px; padding: 11px; border-top-color: #303030; } .card-title strong { font-size: 11px; } .card-footer button { min-height: 29px; padding: 5px 7px; font-size: 10px; }
.version-picker { min-height: 29px; padding: 5px 7px; background: #131313; border-color: #2f3b47; color: #86939f; font-size: 10px; }
.empty { min-height: 270px; gap: 14px; color: #7b8894; } .empty p { font-size: 11px; }
.style-lab { margin-top: 17px; padding: 14px; border: 1px solid #343434; border-radius: 5px; background: linear-gradient(135deg, #171717, #101010); box-shadow: 0 12px 30px #0004; }
.style-lab-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; } .style-lab-head h3 { margin: 4px 0 5px; color: #e6edf1; font-size: 14px; } .style-lab-head p { max-width: 600px; color: #82909c; font-size: 10px; line-height: 1.6; }
.eyebrow { color: #c49758; font: 9px ui-monospace, SFMono-Regular, Menlo, monospace; } .style-lab-mark { color: #82bdb6; } .style-lab-mark svg { width: 20px; height: 20px; }
.style-lab-form { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 7px; margin-top: 12px; } .style-lab-form button { min-width: 104px; }
.style-result { display: grid; grid-template-columns: 200px minmax(0,1fr) auto; align-items: center; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid #2b3641; }
.style-result-copy { display: grid; gap: 4px; min-width: 0; } .style-result-copy strong { color: #edcc97; font-size: 14px; } .style-result-copy p { color: #abb6bf; font-size: 10px; line-height: 1.55; } .style-result-copy small { color: #6f7d89; font-size: 9px; }
.style-samples { display: flex; gap: 5px; min-width: 0; overflow: hidden; } .style-samples img { width: 44px; height: 60px; object-fit: cover; border: 1px solid #4b3c28; border-radius: 3px; cursor: zoom-in; }
.compact-action { white-space: nowrap; }
.toast { bottom: 19px; padding: 10px 14px; background: #1d252d; border-color: #86653a; font-size: 11px; box-shadow: 0 10px 30px #0008; }
.applied-reference { display: grid; gap: 7px; margin: 10px 0; padding: 10px 0; border-block: 1px solid #344b43; color: #a2d6bd; }
.applied-reference span { display: flex; align-items: center; gap: 6px; }
.applied-reference button { justify-self: start; }
#pageEditorDialog { width: min(1280px, calc(100vw - 32px)); max-width: 1280px; max-height: calc(100dvh - 32px); overflow: auto; }
#pageEditorDialog .dialog-bar { position: sticky; top: -22px; z-index: 2; padding: 10px 0; background: #181818; }
.page-edit-grid { display: grid; grid-template-columns: minmax(220px, .7fr) minmax(0, 1.3fr); align-items: start; gap: 24px; margin-top: 16px; }
.page-edit-art { position: sticky; top: 48px; min-width: 0; }
.page-edit-art img { width: 100%; max-height: 72dvh; object-fit: contain; display: block; }
.page-edit-fields { display: grid; gap: 12px; min-width: 0; }
.page-edit-fields .panel-editor { grid-template-columns: 24px minmax(0,1fr); gap: 12px; }
.page-edit-fields .panel-texts { grid-column: 2; }
.page-edit-footer { position: sticky; bottom: -22px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; background: #181818; border-top: 1px solid #343434; }
.page-edit-footer span { color: #98a49e; font-size: 11px; }
#pageEditorError { color: #f0a999; }
.image-task-badge.task-stale { color: #dcb679; }
@media (max-width: 700px) {
  #pageEditorDialog { width: calc(100vw - 16px); padding: 14px; max-height: calc(100dvh - 16px); }
  #pageEditorDialog .dialog-bar { top: -14px; }
  .page-edit-grid { grid-template-columns: minmax(0,1fr); gap: 12px; }
  .page-edit-art { position: static; }.page-edit-art img { max-height: 40dvh; }
  .page-edit-footer { bottom: -14px; flex-wrap: wrap; }
  #pageEditorDialog input, #pageEditorDialog textarea, #pageEditorDialog select { font-size: 16px; }
  .page-edit-fields .text-tools { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
dialog { padding: 22px; background: #181818; color: var(--ink); border-color: #485565; border-radius: 6px; } dialog p { margin: 13px 0 19px; color: #9ba8b2; font-size: 11px; }
#imageDialog { background: #0c0c0c; } .dialog-bar { font-size: 11px; }
#imageNavigation { display: flex; align-items: center; justify-content: center; gap: 16px; padding-top: 12px; }
#imageNavigation[hidden] { display: none; }
#imageNavigation button { min-width: 96px; min-height: 40px; }
#imagePosition { min-width: 56px; text-align: center; font-size: 12px; font-variant-numeric: tabular-nums; color: #b9b9b9; }
#pageScrollControls { position: fixed; right: max(8px, env(safe-area-inset-right)); bottom: calc(100px + env(safe-area-inset-bottom)); z-index: 30; display: grid; gap: 6px; }
#pageScrollControls[hidden], body:has(dialog[open]) #pageScrollControls { display: none; }
#pageScrollControls button { width: 40px; height: 40px; min-height: 40px; padding: 0; border-radius: 6px; background: #202020; color: #c9c9c9; border: 1px solid #424242; box-shadow: 0 2px 8px #0003; }
#pageScrollControls button:hover, #pageScrollControls button:focus-visible { color: #fff; border-color: #b68b49; background: #303030; }
@media (min-width: 1500px) { main { padding-left: 38px; padding-right: 38px; } .comic-grid { grid-template-columns: repeat(5, minmax(0,1fr)); } }
.outline .style-lab { margin: 0 0 24px; padding: 0 0 20px; border: 0; border-bottom: 1px solid var(--line); background: none; box-shadow: none; }
.outline .style-result { grid-template-columns: 1fr; }
.style-notes-label { grid-column: 1 / -1; }
.style-notes-label textarea { min-height: 96px; line-height: 1.7; }
.style-result > small { grid-column: 1 / -1; }
.style-samples img { width: 48px; height: 64px; }
.field-hint { margin-top: -4px; color: #8dafaa; line-height: 1.6; }
.legacy-board article { background: var(--paper); }
.character .image-slot, .card-footer { border-color: var(--line); }
.task-note.failed, .failed { color: #e39b88; }
.activity-icon { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; flex: 0 0 auto; }
.activity-icon svg { width: 100%; height: 100%; }
.task-spinner { animation: comic-task-spin 1s linear infinite; }
@keyframes comic-task-spin { to { transform: rotate(360deg); } }
.activity-summary { display: flex; align-items: center; gap: 10px; min-width: 0; overflow-wrap: anywhere; }
.activity-summary strong { font-size: 12px; font-weight: 550; }
.task-note:has(.activity-icon) { display: flex; align-items: flex-start; gap: 6px; overflow-wrap: anywhere; }
.task-note .activity-icon { width: 14px; height: 14px; margin-top: 2px; }
.task-running, .task-queued { color: #e8c687; }
.task-done { color: #9ad7b7; }
.task-failed { color: #f0a495; }
.task-paused, .task-cancelled { color: #b6b6b6; }
.status.success { border-color: #3c6653; border-left-color: #83c5a1; color: #b4dfc5; background: #131e19; }
.image-task-badge { position: absolute; z-index: 1; top: 9px; right: 9px; display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; max-width: calc(100% - 18px); border: 1px solid currentColor; border-radius: 4px; background: #111e; font-size: 11px; line-height: 1.4; pointer-events: none; }
.image-task-badge .activity-icon { width: 14px; height: 14px; }
.image-slot.task-running > img { opacity: .6; }
.image-slot > .activity-icon { width: 32px; height: 32px; }
.storyboard-activity { min-height: 260px; gap: 14px; }
.storyboard-activity > .activity-icon { width: 36px; height: 36px; }
.storyboard-activity strong { font-size: 15px; font-weight: 550; }
.storyboard-activity p { max-width: 640px; margin: 0; overflow-wrap: anywhere; }
@media (prefers-reduced-motion: reduce) { .task-spinner { animation: none; } }
.adaptation-note { display: block; color: var(--muted); line-height: 1.6; overflow-wrap: anywhere; }
.adaptation-note .restore-original { display: inline-flex; margin-left: 8px; padding: 2px 6px; min-height: 24px; font-size: 11px; vertical-align: baseline; }
.coverage .coverage-link { display: inline; min-height: 0; padding: 0; border: 0; border-radius: 0; background: none; color: inherit; text-align: left; font: inherit; text-decoration: underline; text-underline-offset: 3px; white-space: normal; }
.coverage .coverage-link:hover, .coverage .coverage-link:focus-visible { color: #fff; }
.panel-editor { scroll-margin-top: 24px; }
.page-editor { scroll-margin-top: 16px; }
.result-filter-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px; margin: 14px 0; }
.result-filters { display: flex; flex-wrap: wrap; gap: 4px; }
.result-filters button { min-height: 32px; padding: 6px 10px; border-radius: 4px; background: transparent; border: 1px solid transparent; font-size: 12px; color: #aaa; gap: 6px; }
.result-filters button span { font-variant-numeric: tabular-nums; font-size: 11px; opacity: .8; }
.result-filters button[aria-pressed="true"] { background: #302a20; border-color: #907344; color: #f0cc91; }
.result-filters button:hover { color: #fff; border-color: #555; }
#resultFilterSummary { font-size: 11px; color: #aaa; }
.comic-grid .comic-card[hidden], #resultFilterEmpty[hidden] { display: none; }
.comic-font-setting { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; margin: 16px 0; }
.comic-font-setting label { width: 180px; }
.comic-font-setting small { color: #aaa; font-size: 11px; padding-bottom: 8px; }
.layout-preview.single { grid-template: 1fr / 1fr; }
.page-jump { display:flex;align-items:center;gap:8px;margin:16px 0;flex-wrap:wrap; }
.text-density-row { grid-template-columns:repeat(2,minmax(0,1fr)); }
.text-density-row label,.text-density-row select { min-width:0; }
#boardScopeDialog .actions { margin-top:20px; }
.page-jump label,.page-jump span { font-size:12px;color:var(--muted); }
.page-jump input { width:76px;min-width:0;height:34px;padding:6px 8px; }
.page-jump .icon { width:34px;height:34px; }
.combination-note { flex-basis:100%;font-size:12px;color:var(--muted); }
.page-editor,.page-pending,.comic-card { scroll-margin-top:20px; }
.layout-preview > span { grid-column:auto; margin-top:0; }
.layout-preview.mirror { grid-template: 1fr / 1fr 1fr; }
.layout-preview.diagonal-triple { display:block; }
.layout-preview.diagonal-triple span { position:absolute;left:3px;right:3px;height:36%;clip-path:polygon(0 0,100% 10%,100% 100%,0 90%); }
.layout-preview.diagonal-triple span:nth-child(1){top:3px}
.layout-preview.diagonal-triple span:nth-child(2){top:33%;clip-path:polygon(0 0,100% 10%,100% 90%,0 100%)}
.layout-preview.diagonal-triple span:nth-child(3){bottom:3px;clip-path:polygon(0 10%,100% 0,100% 100%,0 100%)}
.layout-preview.central-memory { display:block; }
.layout-preview.central-memory span:first-child { position:absolute;inset:3px;place-items:end start;padding:8px; }
.layout-preview.central-memory span:not(:first-child) { position:absolute;right:4px;top:5px;width:38%;height:28%;background:#3e4347;border:1px dashed #aeb0ad;z-index:1; }
.layout-preview.central-memory span:nth-child(3){top:auto;bottom:5px}
.layout-preview.cinematic { grid-template-rows:1.6fr 1fr; }
.layout-preview.cinematic[data-count="1"] { grid-template:1fr / 1fr; }
.layout-preview.cinematic[data-count="3"] { grid-template-rows:1fr 1.7fr 1fr; }
.comic-planning-settings { display:flex;flex-wrap:wrap;align-items:end;gap:12px;margin:0 0 18px; }
.comic-planning-settings label { min-width:180px;flex:1;max-width:340px; }
.comic-planning-settings small { flex-basis:100%;color:var(--muted);font-size:12px; }
.page-panel-count { display: flex; gap: 8px; padding: 0; border: 0; margin: 18px 0 24px; }
.page-panel-count legend { margin-bottom: 10px; font-size: 12px; color: #b9b9b9; }
.page-panel-count label { display: flex; flex: 1; align-items: center; justify-content: center; gap: 8px; min-width: 100px; padding: 12px; border: 1px solid #444; border-radius: 6px; cursor: pointer; }
.page-panel-count label:has(input:checked) { border-color: #b68b49; background: #302a20; }
.page-panel-count input { width: 16px; min-height: 16px; height: 16px; margin: 0; accent-color: #b68b49; }
.page-structure-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
.page-structure-actions button { min-height: 30px; padding: 5px 8px; font-size: 11px; }
.page-structure-actions .icon { width: 30px; padding: 5px; }
.panel-editor.coverage-target { outline: 2px solid var(--accent, #c89b55); outline-offset: 4px; }
.rewrite-diff { border: 1px solid var(--line); padding: 12px; margin-bottom: 16px; font-size: 12px; }
.rewrite-diff summary { cursor: pointer; font-weight: 600; }
.rewrite-diff > div { margin-top: 12px; overflow-wrap: anywhere; }
.rewrite-diff strong, .rewrite-diff del, .rewrite-diff ins { display: block; margin-top: 5px; }
.rewrite-diff del { color: #d49b9b; }
.rewrite-diff ins { color: #a9d9c0; text-decoration: none; }
.is-rewriting svg { animation: spin 1s linear infinite; }
.page-edit-footer { flex-wrap: wrap; gap: 10px; }
@media (max-width: 1050px) { .input-layout { grid-template-columns: minmax(0,1fr) 270px; gap: 16px; } main { padding: 20px; } }
@media (max-width: 960px) {
  .input-layout { grid-template-columns: 1fr; }
  .outline { display: block; border: 0; padding: 16px 0 0; }
  .panel-editor { grid-template-columns: 28px minmax(0,1fr); }
  .panel-texts { grid-column: 2; }
  .page-header { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .app-header { height: auto; padding: 10px 13px; }
  .app-shell { display: block; min-height: 0; }
  main { padding: 19px 13px 25px; }
  .sidebar { padding: 8px; }
  .sidebar nav button { font-size: 11px; padding: 8px 2px; }
  .style-result { grid-template-columns: 1fr; }
  .compact-action { justify-self: start; }
  .source-toolbar { align-items: flex-start; flex-wrap: wrap; gap: 4px; }
  .source-import-actions { flex-wrap: wrap; }
  input, textarea, select, label input, label textarea, label select,
  .character-fields textarea, .text-tools select, .text-content textarea { font-size: 16px; }
  .style-lab-form { grid-template-columns: 1fr; }
  .style-lab-form button { justify-self: start; }
  .style-grid { display: flex; overflow-x: auto; overflow-y: hidden; gap: 8px; padding: 2px 2px 7px; scroll-snap-type: x proximity; scrollbar-gutter: auto; }
  .style-card { flex: 0 0 142px; scroll-snap-align: start; }
}
.task-duration { display: inline-block; color: #a9b8b2; font-size: 12px; line-height: 1.5; font-variant-numeric: tabular-nums; white-space: nowrap; }
.activity-summary .task-duration { display: block; margin-top: 4px; }
.comic-card > .task-duration { margin: 8px 12px 0; }
.task-note { flex-wrap: wrap; }
.character-batch-controls { display: flex; align-items: end; flex-wrap: wrap; gap: 12px 20px; margin-bottom: 18px; }
.character-batch-controls label { display: grid; gap: 6px; width: 180px; max-width: 100%; }
.character-batch-controls span { color: var(--muted); font-size: 12px; padding-bottom: 9px; }
/* Watermark editor */
#watermarkDialog { width: min(940px, calc(100vw - 28px)); max-width: min(940px, calc(100vw - 28px)); max-height: calc(100dvh - 32px); padding: 20px; overflow: auto; border-radius: 8px; }
#watermarkDialog .dialog-bar { margin-bottom: 18px; }
.watermark-layout { display: grid; grid-template-columns: minmax(200px, 280px) minmax(0, 1fr); gap: 24px; }
.watermark-fields { display: grid; align-content: start; gap: 18px; }
.watermark-fields label { font-size: 12px; }
.watermark-fields label > span { font-size: 11px; color: #999; }
.watermark-preview { position: relative; min-width: 0; height: min(61dvh, 640px); display: grid; place-items: center; background: #080808; border: 1px solid #333; border-radius: 4px; overflow: hidden; }
#watermarkDialog .watermark-preview img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; max-height: 100%; object-fit: contain; }
#watermarkDialog .watermark-preview img[hidden] { display: none; }
#watermarkPreviewStatus { position: absolute; bottom: 10px; padding: 5px 10px; background: #171717; color: #ddd; font-size: 12px; border-radius: 4px; }
.watermark-error { color: #f5a6a6; font-size: 12px; margin-top: 14px; }
#watermarkProgress { display: grid; gap: 6px; margin-top: 18px; font-size: 12px; }
#watermarkProgress[hidden] { display: none; }
#watermarkProgress progress { width: 100%; height: 6px; accent-color: #d7a45e; }
.watermark-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.watermark-footer button { font-size: 12px; }
@media (max-width: 640px) {
  #watermarkDialog { padding: 14px; }
  .watermark-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .watermark-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .watermark-fields > label:first-child { grid-column: 1 / -1; }
  .watermark-preview { height: 48dvh; }
  .watermark-footer { flex-wrap: wrap; }
  .watermark-footer button { flex: 1 1 150px; }
}
.character-reference { display: grid; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid #343434; }
.character-reference-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 8px; font-size: 12px; }
.character-reference-header small { color: #999; font-size: 11px; }
.character-reference .reference-preview { width: 100%; height: 128px; padding: 6px; background: #eee; border: 1px solid #444; border-radius: 4px; overflow: hidden; }
.character-reference .reference-preview img { width: 100%; height: 100%; object-fit: contain; }
.character-reference input[hidden] { display: none; }
#characterSanitizeDialog { width: min(620px, calc(100vw - 28px)); max-width: calc(100vw - 28px); max-height: calc(100dvh - 32px); overflow: auto; padding: 20px; border-radius: 8px; }
#characterSanitizeForm { display: grid; gap: 16px; margin-top: 16px; }
#characterSanitizeForm textarea { min-height: 110px; }
#characterSanitizeOriginal { white-space: pre-wrap; overflow-wrap: anywhere; color: #aaa; font-size: 12px; }
#characterSanitizeStatus { color: #d7b777; font-size: 13px; margin: 0; }
#characterSanitizeForm .actions { flex-wrap: wrap; }

#comicRewriteDialog { box-sizing: border-box; width: min(980px, calc(100vw - 28px)); max-width: calc(100vw - 28px); max-height: calc(100dvh - 28px); overflow: auto; padding: 20px; }
#comicRewriteDialog label { display: grid; gap: 8px; min-width: 0; font-size: 12px; }
#comicRewriteDialog .check { display: flex; align-items: center; gap: 8px; margin: 14px 0; }
#comicRewriteDialog textarea { width: 100%; box-sizing: border-box; font-size: 13px; line-height: 1.8; resize: vertical; }
#comicRewriteDialog label span { color: #969696; font-size: 11px; }
.comic-rewrite-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.comic-rewrite-columns label { grid-template-columns: 1fr auto; }
.comic-rewrite-columns textarea { grid-column: 1 / -1; height: 310px; min-height: 160px; }
.comic-rewrite-status { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; min-height: 24px; font-size: 12px; color: #c9b786; }
.comic-rewrite-status [data-rw="time"] { color: #aaa; font-variant-numeric: tabular-nums; }
.comic-rewrite-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 16px; }
#comicRewriteDialog.is-rewriting [data-rw="status"]::before { content: ''; display: inline-block; width: 10px; height: 10px; margin-right: 8px; border: 2px solid #555; border-top-color: #d7b777; border-radius: 50%; animation: comic-rewrite-spin 1s linear infinite; }
@keyframes comic-rewrite-spin { to { transform: rotate(360deg); } }
@media (max-width: 700px) {
  #comicRewriteDialog { padding: 16px; }
  .comic-rewrite-columns { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .comic-rewrite-columns textarea { height: 180px; }
  .comic-rewrite-actions button { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) { #comicRewriteDialog.is-rewriting [data-rw="status"]::before { animation: none; } }
/* Personal style library */
.custom-style-badge{display:inline-block;margin-left:6px;padding:2px 6px;border-radius:5px;background:#302842;color:#d4c6f4;font-size:11px;line-height:1.5;vertical-align:middle}
.style-picker-head{gap:8px;flex-wrap:wrap}
.style-tools{flex-wrap:wrap;gap:6px}
.style-tools #manageStyles{font-size:12px;white-space:nowrap;padding:7px 10px}
.custom-style-dialog{width:min(760px,calc(100vw - 28px));max-width:calc(100vw - 28px);max-height:calc(100dvh - 40px);padding:24px;box-sizing:border-box;overflow:auto;border:1px solid #485565;border-radius:10px;color:var(--ink);background:var(--paper)}
.custom-style-dialog::backdrop{background:rgba(24,22,38,.5)}
.custom-style-header{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;margin-bottom:20px}
.custom-style-header h2{margin:0 0 6px;font-size:22px}
.custom-style-header p{margin:0;font-size:13px;color:var(--muted)}
.custom-style-tools{display:flex;gap:10px;margin-bottom:16px}
.custom-style-tools input{min-width:0;flex:1}
.custom-style-list{display:grid;gap:14px}
.custom-style-row{display:grid;grid-template-columns:110px minmax(0,1fr);gap:16px;padding:14px;border:1px solid var(--line);border-radius:12px}
.custom-style-row p{margin:8px 0;white-space:pre-wrap;overflow-wrap:anywhere;font-size:13px;line-height:1.6;max-height:82px;overflow:auto}
.custom-style-row small{display:block;color:var(--muted);margin-bottom:8px}
.custom-style-cover{padding:0;overflow:hidden;aspect-ratio:3/4;border-radius:8px;background:#101010;align-self:start;width:100%}
.custom-style-cover img{display:block;width:100%;height:100%;object-fit:cover}
.custom-style-empty{padding:24px 8px;text-align:center;color:var(--muted)}
#customStyleForm{display:grid;gap:16px}
#customStyleForm>label{display:grid;gap:8px;font-size:14px;font-weight:600}
#customStyleForm input,#customStyleForm textarea{box-sizing:border-box;width:100%;min-width:0}
#customStyleForm textarea{resize:vertical;line-height:1.7}
.custom-style-upload-head{display:flex;gap:10px;align-items:center;justify-content:space-between}
.custom-style-upload-head small{color:var(--muted)}
.custom-style-references{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:10px}
.custom-style-ref{position:relative;min-width:0}
.custom-style-ref img{display:block;width:100%;aspect-ratio:3/4;object-fit:contain;background:#101010;border-radius:8px}
.custom-style-ref button{position:absolute;right:2px;top:2px;width:28px;height:28px;padding:0;border-radius:50%;background:#fff;color:#853750;box-shadow:0 1px 7px #0002}
.custom-style-dialog .actions{display:flex;flex-wrap:wrap;gap:8px}
.custom-style-dialog button{cursor:pointer}
#customStyleDelete{margin-top:18px;padding:14px;background:#2d1d1a;border-radius:8px}
#customStyleDelete[hidden]{display:none}
.custom-style-dialog [hidden]{display:none!important}
@media(max-width:600px){
  .custom-style-dialog{padding:16px;max-height:calc(100dvh - 24px)}
  .custom-style-row{grid-template-columns:76px minmax(0,1fr);gap:10px;padding:10px}
  .custom-style-references{grid-template-columns:repeat(3,minmax(0,1fr))}
  .custom-style-dialog .actions button{font-size:12px;padding:8px 10px}
  .project-tools #manageStylesHeader{font-size:12px;padding:6px}
  .style-picker-head .style-tools{width:100%;justify-content:space-between}
}

/* Keep recovery controls legible while dimming hidden artwork. */
.comic-page-hidden .image-slot img{opacity:.32;filter:grayscale(.35)}
.comic-page-hidden{border-style:dashed}
.page-hidden-label{color:var(--muted);font-size:12px;margin:8px 0}
.visibility-summary{color:var(--muted);font-size:13px;line-height:1.6;margin:12px 0}

/* Promotion keyword dialogs */
#keywordDialog { width: min(560px, calc(100vw - 32px)); max-width: min(560px, calc(100vw - 32px)); padding: 0; }
#keywordDialog form { padding: 8px 28px 28px; }
#keywordDialog .dialog-bar { padding: 20px 28px 14px; }
#keywordDialog .dialog-bar span { font-size: 1.18rem; font-weight: 700; }
#keywordDialog form > label { display: flex; flex-direction: column; gap: 9px; margin: 18px 0; line-height: 1.5; }
#keywordDialog form > label input { margin-top: 0; }
#keywordDialog #keywordTarget { margin: 8px 28px 20px; color: var(--muted, #8f96a3); line-height: 1.6; }
#keywordDialog form > p { margin: 18px 0; line-height: 1.6; }
#zhihuDialog .keyword-choice { display: flex; gap: 18px; align-items: center; margin: 18px 0 12px; padding: 0; border: 0; }
#zhihuDialog .keyword-choice legend { margin-bottom: 9px; font-weight: 600; }
#zhihuDialog .keyword-choice label { display: inline-flex; gap: 7px; align-items: center; }
#zhihuDialog #zhihuKeywordField { gap: 9px; }
@media (max-width: 600px) { #keywordDialog { width: calc(100vw - 20px); max-width: calc(100vw - 20px); } #keywordDialog form, #keywordDialog .dialog-bar { padding-left: 20px; padding-right: 20px; } #keywordDialog #keywordTarget { margin-left: 20px; margin-right: 20px; } }

#projectPicker { width: min(1000px, calc(100vw - 32px)); max-width: min(1000px, calc(100vw - 32px)); max-height: 88vh; overflow: auto; padding: 24px; }
#projectPicker .dialog-bar h2 { margin: 0; }
.project-search { margin-top: 18px; }
#projectPickerStatus { margin: 12px 0; }
.project-cards { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; margin-bottom: 18px; }
.project-card { display: flex; align-items: stretch; gap: 16px; padding: 14px; text-align: left; width: 100%; min-width: 0; white-space: normal; }
.project-card.current { border: 2px solid var(--accent); }
.project-cover { display: flex; align-items: center; justify-content: center; flex: 0 0 96px; width: 96px; height: 128px; border-radius: 6px; background: #8881; color: var(--muted); font-size: 12px; overflow: hidden; }
.project-cover img { width: 100%; height: 100%; object-fit: cover; }
.project-card-info { display: flex; flex-direction: column; gap: 7px; min-width: 0; flex: 1; }
.project-card-info strong { font-size: 15px; overflow-wrap: anywhere; }
.project-preview { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.6; font-weight: 400; font-size: 12px; }
.project-keyword,.project-current { font-size: 12px; color: var(--accent); overflow-wrap: anywhere; }
.project-dates { color: var(--muted); font-size: 11px; font-weight: 400; line-height: 1.7; margin-top: auto; }
@media(max-width:680px) { #projectPicker { padding: 18px; } .project-cards { grid-template-columns: 1fr; } .project-card { gap: 12px; padding: 12px; } .project-cover { flex-basis: 72px; width: 72px; height: 96px; } }

#projectPicker .project-preview { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; max-height: 3.2em; overflow: hidden; }

/* Dialog standard: only the body scrolls; close controls remain in the header. */
html body dialog.comic-dialog-shell { padding: 0; overflow: hidden; max-height: calc(100dvh - 32px); }
html body dialog.comic-dialog-shell[open] { display: flex; flex-direction: column; }
html body dialog.comic-dialog-shell > .comic-dialog-header { position: relative; top: auto; flex: 0 0 auto; margin: 0; padding: 18px 22px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid #ffffff14; background: #181818; z-index: 3; }
html body dialog.comic-dialog-shell > .comic-dialog-header h2 { margin: 0; font-size: 18px; }
html body dialog.comic-dialog-shell > .comic-dialog-header > :first-child { min-width: 0; overflow-wrap: anywhere; }
html body dialog.comic-dialog-shell > .comic-dialog-header > button:last-child { flex: 0 0 34px; width: 34px; height: 34px; min-height: 34px; padding: 7px; margin-left: auto; border-radius: 9px; }
html body dialog.comic-dialog-shell > .comic-dialog-body { min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; padding: 22px; }
html body #keywordDialog.comic-dialog-shell > .comic-dialog-body { padding: 22px 28px; }
#keywordDialog.comic-dialog-shell #keywordTarget { margin: 0 0 16px; }
#keywordDialog.comic-dialog-shell form { padding: 0; }
#imageDialog.comic-dialog-shell .comic-dialog-body { text-align: center; }
.project-tools #manageStylesHeader { --action-a: #bca6f4; --action-b: #9780d6; --action-ink: #24143e; }
.project-tools #projects { --action-a: #98c7fb; --action-b: #70a6e7; --action-ink: #102b4c; }
.project-tools #newProject { --action-a: #82ddc6; --action-b: #53bda5; --action-ink: #0d352c; }
.project-tools #applyKeywordHeader { --action-a: #ffd196; --action-b: #efaa60; --action-ink: #492a0d; }
.app-header .project-tools button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 8px 12px; border: 1px solid #ffffff26; border-radius: 10px; background: linear-gradient(135deg,var(--action-a),var(--action-b)); color: var(--action-ink); box-shadow: 0 3px 9px #0002,inset 0 1px #ffffff35; font-weight: 650; transition: transform .16s ease,box-shadow .16s ease,filter .16s ease; }
@media (hover:hover) { .app-header .project-tools button:hover:not(:disabled) { background: linear-gradient(135deg,var(--action-a),var(--action-b)); transform: translateY(-2px); filter: brightness(1.06); box-shadow: 0 6px 15px #0003; } }
.app-header .project-tools button:active:not(:disabled) { transform: translateY(0) scale(.98); }
.app-header .project-tools button:focus-visible { outline: 2px solid var(--action-a); outline-offset: 3px; }
.app-header .project-tools button:disabled { opacity: .55; }
@media(max-width:680px) { html body dialog.comic-dialog-shell { max-height: calc(100dvh - 20px); } html body dialog.comic-dialog-shell > .comic-dialog-header { padding: 14px 16px; } html body dialog.comic-dialog-shell > .comic-dialog-body, html body #keywordDialog.comic-dialog-shell > .comic-dialog-body { padding: 16px; } .app-header .project-tools { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; width: 100%; } .app-header .project-tools button { width: 100%; margin: 0; min-width: 0; padding: 9px 8px; font-size: 12px; } }
@media(prefers-reduced-motion:reduce) { .app-header .project-tools button { transition: none; } .app-header .project-tools button:hover:not(:disabled), .app-header .project-tools button:active:not(:disabled) { transform: none; } }

.source-replace{border:1px solid var(--line);border-radius:10px;padding:12px 14px;margin:10px 0}.source-replace summary{cursor:pointer;font-weight:600}.source-replace-fields{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-top:14px}.source-replace-fields label{display:grid;gap:8px;min-width:0}.source-replace-fields input{width:100%;min-width:0;box-sizing:border-box}.source-replace .actions{display:flex;flex-wrap:wrap;gap:8px}.source-replace small{display:block;margin-top:12px;color:var(--muted);line-height:1.6}@media(max-width:680px){.source-replace-fields{grid-template-columns:1fr}.source-replace .actions button{flex:1 1 40%}}
