/* Inkflow: an editorial writing room, with account-based creative continuity. */
:root {
  --bg: #f4f2ed;
  --bg-2: #eeebe4;
  --panel: #fffdf8;
  --panel-2: #f8f6f0;
  --panel-3: #f0ede5;
  --line: #e4e1d8;
  --line-2: #d3d0c6;
  --ink: #1b3036;
  --ink-2: #4b5c60;
  --ink-3: #6e7879;
  --accent: #b74829;
  --accent-2: #cb5b39;
  --accent-soft: #faeade;
  --blue: #355c6a;
  --blue-soft: #edf2f2;
  --radius: 8px;
  --radius-s: 5px;
  --shadow-s: 0 1px 2px #152b3510;
  --shadow: 0 8px 30px #152b3510;
  --shadow-l: 0 28px 80px #10283333;
  --sans: "Microsoft YaHei UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --serif: "STZhongsong", "Songti SC", "Noto Serif CJK SC", SimSun, Georgia, serif;
}
body { background: var(--bg); background-image: none; font-size: 13px; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible { outline: 3px solid #d57852; outline-offset: 3px; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid #ba593a; outline-offset: 1px; }
::selection { background: #f1c4a8; color: #172d35; }
::placeholder { color: #8c9290; }
[hidden] { display: none !important; }
.eyebrow { display: block; font-family: var(--mono); font-size: 9px; font-weight: 500; line-height: 1.5; letter-spacing: 1.8px; }

/* The entry page is a book jacket paired with a deliberately quiet form. */
.auth-screen { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 1.05fr 1fr; overflow: auto; height: 100%; }
.auth-story { position: relative; min-height: 760px; padding: 44px 8%; display: flex; flex-direction: column; background: #142b33; color: #faf3e8; overflow: hidden; }
.auth-story::before { content: ""; position: absolute; inset: 0; pointer-events: none; background-image: linear-gradient(#ffffff04 1px, transparent 1px), linear-gradient(90deg, #ffffff04 1px, transparent 1px); background-size: 64px 64px; mask-image: linear-gradient(120deg, transparent, #000); }
.auth-wordmark { display: flex; gap: 12px; align-items: center; text-decoration: none; color: inherit; width: fit-content; z-index: 1; }
.auth-wordmark > span { font-family: var(--serif); font-size: 25px; letter-spacing: 3px; }
.auth-wordmark small { display: block; font-family: var(--mono); font-size: 9px; letter-spacing: 3px; color: #b7c4c3; }
.auth-editorial { position: relative; margin: auto 0; padding: 55px 0 135px; z-index: 1; }
.auth-editorial > .eyebrow { color: #dda585; font-size: 10px; }
.auth-editorial h1 { position: relative; z-index: 2; font-family: var(--serif); font-size: clamp(38px, 4.1vw, 66px); font-weight: 500; letter-spacing: -1px; line-height: 1.44; margin: 26px 0 22px; }
.auth-editorial p { position: relative; z-index: 2; margin: 0; color: #b8c5c5; font-size: 13px; line-height: 2.1; }
.auth-book { position: absolute; width: 188px; height: 246px; bottom: -25px; right: 12px; transform: rotate(12deg); background: #e6a27c; color: #263b3f; border-radius: 1px 5px 5px 1px; box-shadow: 11px 17px 0 #0b212888, -7px 0 0 #c88b69; display: flex; flex-direction: column; padding: 28px 20px 20px 27px; }
.auth-book::after { content: ""; position: absolute; inset: 0 0 0 8px; border-left: 1px solid #713e2d33; border-right: 4px solid #fff3d055; }
.book-rule { width: 25px; height: 3px; background: currentColor; }
.book-title { font-family: var(--serif); font-size: 29px; letter-spacing: 3px; line-height: 1.5; margin-top: 16px; }
.book-number { margin-top: auto; font-size: 10px; font-family: var(--mono); letter-spacing: 2px; }
.auth-caption { z-index: 1; display: flex; justify-content: space-between; color: #a9baba; font-size: 10px; gap: 12px; border-top: 1px solid #bed0cd24; padding-top: 20px; }
.auth-caption > span:last-child { font-size: 8px; letter-spacing: 1px; font-family: var(--mono); }
.auth-entry { background: #fcfaf5; min-width: 0; position: relative; padding: 56px 35px 74px; display: flex; align-items: center; justify-content: center; }
.auth-form-wrap { width: 100%; max-width: 360px; }
.auth-form-wrap > .eyebrow { color: #a85639; margin-bottom: 15px; }
.auth-form-wrap h2 { font-family: var(--serif); font-size: 31px; font-weight: 500; margin: 0 0 12px; letter-spacing: 1px; }
.auth-description { color: #707b7d; margin: 0 0 35px; font-size: 13px; }
.auth-form { display: flex; flex-direction: column; gap: 21px; }
.studio-field { display: flex; flex-direction: column; min-width: 0; gap: 8px; margin: 0; }
.studio-field > span, .studio-field > label { color: #44595e; font-size: 12px; font-weight: 600; }
.studio-field input, .studio-field select, .studio-field textarea { width: 100%; min-width: 0; border: 1px solid #d7dcd8; background: #fffefa; color: #20363b; padding: 11px 12px; border-radius: 5px; outline: 0; }
.studio-field input:focus, .studio-field select:focus, .studio-field textarea:focus { border-color: #b85e3d; box-shadow: 0 0 0 3px #e69c7022; }
.studio-field textarea { min-height: 120px; resize: vertical; line-height: 1.8; }
.auth-form .studio-field input { min-height: 48px; }
.btn.primary { background: #b74829; border-color: #b74829; color: #fffdf8; box-shadow: none; }
.btn.primary:hover { background: #a43e21; border-color: #a43e21; }
.btn { border-radius: 5px; padding: 8px 11px; font-weight: 500; box-shadow: none; }
.btn:hover { transform: none; }
.btn, .model-chip, .proj-title, .ch-item, .tab { transition: background-color .15s, color .15s, border-color .15s, box-shadow .15s; }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.ghost:hover { background: #eeeae1; border-color: #ccc6b8; }
.btn.tiny { padding: 5px 8px; font-size: 11px; border-radius: 4px; }
.auth-submit { min-height: 49px; margin-top: 5px; font-size: 13px; justify-content: space-between; padding: 13px 18px; }
.auth-submit > span { font-size: 20px; font-weight: 400; }
.auth-error { border-left: 3px solid #ba4a2c; background: #faeee6; color: #9b371d; font-size: 12px; margin: 0; padding: 10px 12px; }
.auth-error:empty { display: none; }
.auth-loading { margin: 0; color: #5c6b6d; font-size: 12px; }
.auth-switch { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 11px; color: #748083; margin-top: 23px; }
.auth-switch button { border: 0; padding: 5px 0; font-weight: 600; color: #a34428; background: transparent; cursor: pointer; }
.auth-assurance { display: flex; gap: 13px; align-items: center; color: #7d8988; border-top: 1px solid #e3e5dc; margin-top: 36px; padding-top: 24px; }
.assurance-mark { font-family: var(--serif); font-size: 29px; color: #acb7b1; }
.auth-assurance p { font-size: 10px; margin: 0; line-height: 1.9; }
.auth-footnote { position: absolute; bottom: 25px; color: #8b9693; font-size: 10px; letter-spacing: 1px; }

/* The rail anchors the whole workspace; the writing sheet takes precedence. */
#app { display: grid; grid-template-columns: 68px minmax(0,1fr); grid-template-rows: 76px 55px minmax(0,1fr); height: 100vh; height: 100dvh; min-width: 0; }
.studio-rail { grid-column: 1; grid-row: 1 / -1; background: #142b33; display: flex; flex-direction: column; align-items: center; padding: 20px 7px; gap: 11px; z-index: 50; }
.rail-mark { border-radius: 11px; }
.rail-rule { display: block; margin: 12px 0 8px; width: 26px; border-top: 1px solid #69808050; }
.rail-button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; width: 50px; min-height: 60px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: #c3d0ce; cursor: pointer; }
.rail-button > span { font-size: 24px; line-height: 1; font-family: Georgia, serif; }
.rail-button small { font-size: 9px; letter-spacing: 1px; }
.rail-button:hover { background: #28434b; }
.rail-button.active, .rail-button.on { color: #f4b18d; border-color: #b8876744; background: #314249; }
.rail-signature { margin-top: auto; color: #88a2a2; writing-mode: vertical-rl; letter-spacing: 3px; font-family: var(--mono); font-size: 9px; }
.topbar { grid-column: 2; grid-row: 1; min-width: 0; height: auto; padding: 0 24px; gap: 12px; border-bottom: 1px solid #e3e2d9; background: #fcfaf6; flex-wrap: nowrap; }
.brand { padding-right: 18px; border-right: 1px solid #dce0d9; flex-shrink: 0; }
.brand-text { font-family: var(--serif); color: #213941; letter-spacing: 2px; font-size: 21px; font-weight: 500; }
.brand-text small { display: block; font-family: var(--sans); font-size: 9px; color: #778481; letter-spacing: 1px; margin: 2px 0 0; }
.project-heading { display: flex; flex-direction: column; min-width: 90px; max-width: 300px; }
.project-heading > .eyebrow { color: #778781; font-size: 8px; letter-spacing: 1.1px; margin-left: 7px; }
.proj-title { min-width: 0; width: 100%; padding: 1px 6px; border-color: transparent; border-radius: 3px; background: transparent; font-size: 19px; font-weight: 500; letter-spacing: .5px; }
.proj-title:hover { background: #f0eee7; }
.model-chip { border: 0; background: #eeefe8; color: #596961; padding: 5px 9px; max-width: 170px; border-radius: 4px; font-size: 10px; }
.model-chip .dot { width: 5px; height: 5px; flex-basis: 5px; }
.model-chip.ok .dot { box-shadow: none; }
.topbar .btn { font-size: 11px; padding: 6px 9px; border-color: transparent; }
.topbar #btnKeys { border-color: #d4d6cb; }
.member-button { display: flex; align-items: center; gap: 8px; border: 0; border-left: 1px solid #dce0d9; padding: 0 0 0 15px; color: #40565a; font-size: 11px; background: transparent; cursor: pointer; min-width: 0; }
.member-avatar { background: #e5b390; color: #1d3942; width: 31px; height: 31px; display: grid; place-items: center; border-radius: 50%; font-family: var(--serif); font-size: 14px; }
#memberName { max-width: 86px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.studio-workflow { grid-column: 2; grid-row: 2; display: flex; align-items: center; justify-content: space-between; gap: 15px; min-width: 0; padding: 0 24px; background: #fffdf8; border-bottom: 1px solid var(--line); }
.studio-stages { display: flex; align-items: center; gap: 10px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.studio-stages::-webkit-scrollbar { display: none; }
.studio-stages button { border: 0; padding: 6px 3px; background: transparent; color: #75807c; font-size: 11px; white-space: nowrap; cursor: pointer; }
.studio-stages button span { font-family: var(--mono); font-size: 9px; color: #8b9790; margin-right: 5px; }
.studio-stages button.active, .studio-stages button.on { color: #a63c20; font-weight: 600; }
.studio-stages button.active span, .studio-stages button.on span { color: #a63c20; }
.studio-stages i { color: #d5d7ce; font-style: normal; }
.studio-save { display: flex; align-items: center; gap: 15px; flex: 0 0 auto; }
.studio-mode { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; margin-left: auto; }
.studio-mode label { font-size: 10px; color: #7c897e; white-space: nowrap; flex: 0 0 auto; }
.studio-mode select { background: #f4f3e9; border: 1px solid #dce1d2; border-radius: 4px; padding: 5px 8px; font-size: 10px; color: #536b57; width: 100px; max-width: 110px; flex: 0 0 auto; }
.studio-mode .btn { font-size: 9px; border-color: transparent; color: #7e755f; padding: 5px 3px; }
#saveStatus { font-size: 10px; color: #628070; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#saveStatus::before { content: ""; display: inline-block; width: 4px; height: 4px; background: currentColor; border-radius: 50%; vertical-align: middle; margin-right: 5px; }
#btnSaveWorkspace { color: #455b5e; font-size: 10px; }
.layout { grid-column: 2; grid-row: 3; grid-template-columns: 265px minmax(0,1fr) 292px; min-width: 0; width: 100%; }
.layout.no-console { grid-template-columns: 265px minmax(0,1fr); }
.sidebar { background: #f8f8f2; border-color: #dce0d7; }
.library-heading { padding: 23px 19px 17px; background: #eff0e8; }
.library-heading .eyebrow { color: #71867f; font-size: 8px; }
.library-heading h2 { font-size: 20px; margin: 4px 0 4px; font-family: var(--serif); font-weight: 500; letter-spacing: 1px; }
#studioStats { color: #74817a; font-size: 10px; }
.tabs { padding: 0 10px; background: #eff0e8; gap: 2px; border-color: #dce0d7; }
.tab { border-radius: 0; font-size: 11px; padding: 11px 6px; font-weight: 500; }
.tab.on { color: #a44427; background: transparent; border-bottom-color: #b25c3b; }
.pane { padding: 16px 13px; }
.pane-actions { margin-bottom: 20px; }
.pane-actions .btn.primary { background: #1e3b42; border-color: #1e3b42; font-size: 11px; }
.pane-actions .btn.primary:hover { background: #2d5057; }
.pane-actions .btn.ghost { font-size: 10px; background: #fffdf8; }
.ch-meta { font-size: 9px; padding-bottom: 10px; letter-spacing: .2px; }
.ch-list { gap: 3px; }
.ch-item { background: transparent; border: 0; border-left: 2px solid transparent; border-radius: 0; padding: 11px 7px; gap: 7px; }
.ch-item:hover { background: #ecefe6; }
.ch-item.on { background: #e7ede4; border-left-color: #a95636; box-shadow: none; }
.ch-idx { font-size: 9px; font-weight: 400; width: 20px; flex-basis: 20px; color: #8d9b91; background: transparent; }
.ch-item.on .ch-idx { color: #a6492a; background: transparent; }
.ch-name { font-size: 12px; font-weight: 500; }
.ch-item.on .ch-name { color: #254538; }
.ch-sub { font-size: 9px; margin-top: 4px; gap: 5px; }
.ch-item.on .ch-sub { color: #6d8072; }
.ch-del { color: #8b948b; }
.sidebar .sec-title { font-size: 11px; color: #466050; padding-top: 17px; }
.sidebar .lbl { font-size: 10px; color: #62716a; }
.sidebar .note { font-size: 10px; border: 0; background: #eeefe7; color: #6f7d73; }
.sidebar .fld input, .sidebar .fld textarea, .sidebar .fld select { background: #fffef9; font-size: 11px; border-color: #d9dfd4; padding: 7px 8px; }
.sidebar .row2 { gap: 5px; }
.sidebar .btn { font-size: 10px; padding: 7px; }
.work { background: #eeece5; }
.work-head { background: #f7f5ed; padding: 15px 26px; min-height: 69px; border-color: #e0dfd4; gap: 10px; }
.ch-title { font-size: 19px; font-weight: 500; padding: 3px 5px; letter-spacing: .4px; }
.ch-tools { gap: 8px; }
.mini { font-size: 9px; color: #788276; gap: 4px; font-weight: 400; }
.mini input { width: 62px; border-color: #deded2; padding: 3px 5px; font-size: 10px; background: transparent; }
.wc, .status-pill { border: 0; border-radius: 3px; font-size: 9px; padding: 4px 6px; font-weight: 400; }
.work-body { padding: 22px 28px 45px; gap: 20px; }
.block { border-radius: 3px; border-color: #e1dfd3; box-shadow: 0 2px 4px #39432d04; flex: 0 0 auto; }
.block-head { background: #faf8f1; padding: 11px 16px; gap: 8px; min-width: 0; }
.block-head b { font-weight: 500; color: #526759; font-size: 10px; letter-spacing: 1px; white-space: nowrap; }
.block-head .hint { color: #8b9187; font-size: 9px; }
.block-head .btn { color: #68786a; border-color: transparent; font-size: 9px; padding: 3px 4px; }
#chHints { min-height: 97px; padding: 16px 19px; font-size: 12px; line-height: 1.9; color: #5e6b5d; }
.text-block { border: 0; box-shadow: 0 3px 22px #22302308; }
.text-block .block-head { border-bottom: 1px solid #e8e4d9; background: #fffdf7; }
#chContent { font-size: 17px; line-height: 2.2; letter-spacing: .4px; padding: 28px 35px; min-height: 56vh; color: #28362d; background: #fffdf8; }
.console { background: #fafaf5; border-color: #dce0d7; }
.console-head { background: #fafaf5; border: 0; padding: 23px 18px 12px; font-family: var(--serif); font-size: 18px; font-weight: 500; line-height: 1.8; }
.console-head .eyebrow { color: #8a968a; font-size: 8px; letter-spacing: 1px; font-family: var(--mono); }
.console-head > .btn { font-family: var(--sans); color: #818b80; font-size: 9px; padding: 5px; border: 0; }
.console-body { padding-bottom: 20px; }
.console .sec { margin: 0 14px; padding: 16px 2px; border-color: #e2e5db; gap: 8px; }
.sec h4 { color: #7b887c; font-weight: 500; font-size: 10px; letter-spacing: .5px; }
.console .btn { font-size: 11px; padding: 8px 5px; }
.console .btn.primary { min-height: 40px; justify-content: center; }
#btnWrite { justify-content: space-between; padding: 10px 16px; }
#btnWrite > span { font-size: 18px; line-height: 1; }
.console .btn.ghost { background: #f5f5ec; border-color: #e2e5da; }
.console .btn.ghost:hover { background: #eaece1; }
.console textarea { border-color: #dce1d4; background: #fffdf8; font-size: 11px; line-height: 1.8; padding: 10px; }
.material-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.material-heading h4 { margin: 0; }
.material-heading .btn { font-size: 9px; padding: 3px 4px; border-color: transparent !important; background: transparent !important; }
.material-description { margin: 0 0 3px; color: #889283; font-size: 10px; }
.asset-quick-list { display: grid; gap: 6px; }
.asset-empty { border: 1px dashed #d4dccb; color: #81917f; padding: 17px 10px; text-align: center; font-size: 10px; }
.asset-quick-item { border-left: 2px solid #d6b79a; padding: 6px 8px; background: #f0f1e7; font-size: 11px; overflow-wrap: anywhere; cursor: pointer; }
.asset-quick-item small { display: block; font-size: 9px; color: #7f8b7a; }
.console-open { background: #f4eee0 !important; color: #7c624e; top: 10px; }
.sel-bar { background: #203b41; color: #f5f1e5; border-color: #36545a; }
.sel-bar .btn { color: #efefe0; border-color: #66807977; background: transparent; }
.sel-bar .btn:hover { background: #385759; }

/* Shared surfaces for the account, saved materials and version dialogs. */
.modal { background: #112c365e; backdrop-filter: blur(4px); }
.modal-card { border-radius: 10px; border: 1px solid #d5dcd1; box-shadow: 0 30px 90px #112c363d; }
.modal-head { background: #f1f2e9; padding: 18px 22px; border-color: #dfe4d7; }
.modal-head h3 { font-size: 19px; font-weight: 500; }
.modal-body { padding: 22px; }
.modal-foot { background: #f8f8f0; border-color: #dfe4d7; padding: 15px 22px; flex-wrap: wrap; }
.tabsline button { color: #788374; font-size: 11px; }
.tabsline button.on { color: #a14425; border-color: #ad5735; }
.note { border-radius: 5px; font-size: 11px; }
.note.blue { color: #49676a; background: #eef3ef; border-color: #d7e4d7; }
.note.blue b { color: #365d60; }
.studio-modal { max-width: 900px; }
.studio-card { border: 1px solid #dce3d6; background: #fffef7; padding: 18px; border-radius: 7px; margin-bottom: 14px; min-width: 0; }
.studio-card h4 { margin: 0 0 13px; font-size: 14px; font-weight: 500; }
.studio-card p { font-size: 12px; color: #6b7a6a; line-height: 1.8; }
.studio-tabs { display: flex; gap: 7px; flex-wrap: wrap; border-bottom: 1px solid #e1e4d7; padding-bottom: 14px; margin-bottom: 18px; }
.studio-tabs button { background: transparent; border: 1px solid #d6dfcf; border-radius: 4px; padding: 7px 12px; color: #6a7c68; font-size: 11px; cursor: pointer; }
.studio-tabs button.active, .studio-tabs button.on { background: #263f42; color: #fffdf4; border-color: #263f42; }
.studio-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; }
.studio-notice { background: #f4f1e6; border-left: 2px solid #c99a70; padding: 13px 15px; color: #746a55; font-size: 12px; margin-bottom: 15px; overflow-wrap: anywhere; }
.asset-list { display: flex; flex-direction: column; gap: 10px; }
.asset-item { border: 1px solid #dce2d5; background: #fffef8; border-radius: 6px; padding: 15px; min-width: 0; overflow-wrap: anywhere; }
.asset-item h4 { margin: 0 0 6px; font-size: 13px; font-weight: 500; }
.asset-item p { color: #70806b; font-size: 11px; white-space: pre-wrap; line-height: 1.8; }
.asset-item small { font-size: 10px; color: #7f8c76; }
.studio-empty { padding: 32px 20px; border: 1px dashed #ccd7c3; color: #829178; font-size: 12px; text-align: center; }
.studio-pill { display: inline-block; padding: 2px 7px; background: #eef0e5; color: #687c60; border-radius: 4px; font-size: 10px; }
.studio-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 15px; }

@media (min-width: 1600px) {
  .layout { grid-template-columns: 284px minmax(0,1fr) 310px; }
  .layout.no-console { grid-template-columns: 284px minmax(0,1fr); }
  .work-body { padding: 30px clamp(30px,5vw,95px) 55px; }
}
@media (max-width: 1240px) {
  .layout { grid-template-columns: 240px minmax(0,1fr) 255px; }
  .layout.no-console { grid-template-columns: 240px minmax(0,1fr); }
  .topbar { padding: 0 17px; gap: 8px; }
  .brand { padding-right: 12px; }
  .project-heading { max-width: 230px; }
  .model-chip { max-width: 120px; }
  .studio-workflow { padding: 0 17px; }
  .studio-stages { gap: 6px; }
  .studio-stages button { font-size: 10px; }
  .studio-stages button span { margin-right: 2px; }
  .studio-save { gap: 7px; }
  .studio-mode { gap: 5px; }
  .studio-mode label { display: none; }
  .studio-mode .btn { font-size: 0; }
  .studio-mode .btn::after { content: "指南"; font-size: 10px; }
  .studio-save #saveStatus { max-width: 104px; }
  .work-head { padding: 14px 17px; flex-wrap: wrap; }
  .ch-title { flex: 1 1 170px; }
  .ch-tools { margin-left: auto; }
  .work-body { padding: 19px 19px 40px; }
  #chContent { padding: 24px; }
}
@media (max-width: 1080px) {
  #app { grid-template-columns: 58px minmax(0,1fr); }
  .studio-rail { padding: 20px 4px; }
  .rail-button { width: 46px; }
  .layout, .layout.no-console { grid-template-columns: minmax(0,1fr) 276px; }
  .layout.no-console { grid-template-columns: minmax(0,1fr); }
  .sidebar { top: 131px; left: 58px; bottom: 0; width: 280px; box-shadow: 15px 12px 40px #142b3320; }
  .brand { display: none; }
  .studio-save #saveStatus { max-width: 85px; }
  #memberName { max-width: 65px; }
  .member-button { padding-left: 9px; }
  .studio-stages button span { display: none; }
}
@media (max-width: 820px) {
  #app { grid-template-columns: 1fr; grid-template-rows: 84px 80px minmax(0,1fr); }
  .studio-rail { display: none; }
  .topbar, .studio-workflow, .layout { grid-column: 1; }
  .topbar { padding: 10px 15px; gap: 7px; flex-wrap: wrap; align-content: center; }
  .project-heading { flex: 1; max-width: none; min-width: 100px; }
  .project-heading > .eyebrow { display: none; }
  .topbar .proj-title { width: 100%; font-size: 18px; }
  .model-chip { max-width: 150px; flex: 0 1 auto; }
  .tb-spacer { display: none; }
  .member-button { margin-left: auto; border-left: 0; padding: 0; }
  .member-avatar { width: 29px; height: 29px; }
  #memberName, .member-button > span:last-child { display: none; }
  .topbar .btn { font-size: 10px; }
  .studio-workflow { padding: 5px 15px; gap: 0 6px; flex-wrap: wrap; }
  .studio-stages { gap: 5px; flex: 1 0 100%; justify-content: space-between; }
  .studio-stages button { font-size: 10px; padding: 8px 2px; }
  .studio-save { gap: 0; }
  .studio-mode { margin-left: 0; margin-right: auto; }
  .studio-mode label { display: block; font-size: 9px; }
  .studio-save #saveStatus { max-width: 80px; font-size: 9px; }
  #btnSaveWorkspace { font-size: 0; border-color: transparent; padding: 7px; }
  #btnSaveWorkspace::after { content: "保存"; font-size: 10px; }
  .layout, .layout.no-console { grid-template-columns: minmax(0,1fr); }
  .sidebar, .console { top: 164px; bottom: 0; }
  .sidebar { left: 0; width: min(300px, 88vw); }
  .console { width: min(315px,90vw); right: 0; box-shadow: -15px 12px 40px #142b3320; }
  .sidebar:not(.open), .console:not(.open) { display: none !important; }
  .sidebar.open, .console.open, .layout.no-console .console.open { display: flex !important; }
  .ch-tools { flex: 0 0 auto; }
  .work-head { padding: 11px 15px; min-height: 61px; }
  .work-body { padding: 17px 18px 40px; }
  .auth-story { padding: 30px 8%; min-height: 750px; }
  .auth-book { width: 140px; height: 190px; right: 0; bottom: 5px; padding: 20px; }
  .book-title { font-size: 23px; }
  .auth-caption { flex-direction: column; }
  .auth-entry { padding: 35px 25px 65px; }
  .auth-form-wrap h2 { font-size: 26px; }
}
@media (max-width: 600px) {
  .auth-screen { display: block; }
  .auth-story { min-height: 0; padding: 23px 26px 28px; }
  .auth-wordmark img { width: 34px; height: 34px; }
  .auth-wordmark > span { font-size: 20px; }
  .auth-wordmark small { font-size: 7px; }
  .auth-editorial { padding: 26px 0 0; margin: 0; }
  .auth-editorial > .eyebrow { font-size: 7px; letter-spacing: 1.7px; }
  .auth-editorial h1 { font-size: 34px; line-height: 1.4; margin: 12px 0 0; }
  .auth-editorial p, .auth-book, .auth-caption { display: none; }
  .auth-entry { padding: 35px 26px 60px; min-height: 520px; }
  .auth-form-wrap > .eyebrow { font-size: 8px; margin-bottom: 11px; }
  .auth-form-wrap h2 { font-size: 26px; }
  .auth-description { font-size: 12px; margin-bottom: 23px; }
  .auth-form { gap: 17px; }
  .auth-assurance { margin-top: 24px; padding-top: 17px; }
  .auth-footnote { bottom: 18px; font-size: 9px; }
  #app { grid-template-rows: 94px 80px minmax(0,1fr); }
  .topbar { height: auto; flex: none; padding: 8px 11px; gap: 6px; }
  #btnSidebar { order: 0; height: 32px; width: 26px; flex: 0 0 26px; padding: 0; }
  .project-heading { order: 1; flex: 1 1 calc(100% - 140px); width: 0; min-width: 0; }
  .topbar .proj-title { height: 32px; min-width: 0; width: 100%; padding: 3px 5px; font-size: 17px; flex: none; }
  .member-button { order: 2; margin-left: 4px; flex: 0 0 29px; }
  .topbar .model-chip { order: 3; flex: 1 1 100px; max-width: none; min-width: 0; height: 27px; padding: 4px 7px; font-size: 9px; }
  #btnProjects { order: 4; }
  #btnExport { order: 5; }
  #btnKeys { order: 6; flex: 0 0 auto; width: auto; }
  #btnProjects, #btnExport, #btnKeys { padding: 5px 7px; height: 27px; font-size: 10px; }
  .studio-workflow { gap: 0 4px; padding: 3px 12px; }
  .studio-stages { gap: 3px; flex: 1 0 100%; }
  .studio-stages button { font-size: 10px; padding: 8px 2px; }
  .studio-stages i { font-size: 9px; }
  .studio-save #saveStatus { display: none; }
  #btnSaveWorkspace { padding: 7px 2px 7px 7px; }
  .studio-mode select { max-width: 100px; font-size: 10px; padding: 4px 7px; }
  .studio-mode .btn { padding-left: 5px; }
  .sidebar, .console { top: 174px; }
  .work-head { gap: 5px 7px; padding: 10px 12px; min-height: 91px; }
  .work-head .ch-title { flex: 1 1 0; width: 0; min-width: 0; font-size: 17px; }
  .ch-tools { flex: 1 0 100%; gap: 6px; justify-content: space-between; }
  .ch-tools .mini { font-size: 9px; }
  .ch-tools .mini input { width: 60px; }
  .ch-tools .wc, .ch-tools .status-pill { font-size: 9px; padding: 3px 6px; }
  .work-body { padding: 12px 11px 36px; gap: 15px; }
  .block-head { padding: 10px 10px; gap: 5px; flex-wrap: wrap; }
  .block-head b { font-size: 10px; }
  .block-head .hint { min-width: 0; font-size: 9px; }
  .block-head .btn { font-size: 9px; }
  #chHints { padding: 12px; min-height: 91px; font-size: 12px; }
  #chContent { padding: 20px 17px; font-size: 16px; line-height: 2.15; min-height: 52vh; }
  .text-block .block-head .hint { display: none; }
  .text-block .block-head b { margin-right: auto; }
  .modal { padding: 9px; }
  .modal-card { max-height: 94dvh; border-radius: 8px; }
  .modal-head, .modal-body, .modal-foot { padding: 15px; }
  .modal-head h3 { font-size: 17px; }
  .modal-foot { gap: 6px; }
  .modal-foot .btn { font-size: 11px; }
  .studio-grid { grid-template-columns: 1fr; }
  .studio-card { padding: 14px; }
  .studio-tabs { gap: 5px; }
  .studio-tabs button { padding: 6px 9px; }
  .studio-field input, .studio-field select, .studio-field textarea { font-size: 16px; }
  .prov-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
.studio-account-banner { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 0 0 22px; }
.studio-account-banner h2 { font-family: var(--serif); font-size: 28px; margin: 6px 0 0; font-weight: 500; }
.studio-account-banner small { letter-spacing: 2px; color: var(--accent); font-family: var(--mono); font-size: 10px; }
.studio-account-banner p { margin: 3px 0; color: var(--ink-3); }
.member-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.member-row small { display: block; }
#memberUsers { margin-top: 18px; }
.studio-result { white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--serif); font-size: 15px; line-height: 1.95; margin-bottom: 0; }
.studio-version-form { display: flex; gap: 9px; flex-wrap: wrap; margin-bottom: 15px; }
.studio-version-form input { min-width: 120px; flex: 1; padding: 10px 12px; border: 1px solid var(--line-2); background: var(--panel); border-radius: 5px; }
.asset-item .btnrow { flex-wrap: wrap; margin-top: 9px; }
#studioPanelMessage { max-width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; }
#studioPanelMessage.error { color: var(--red); }
#platformCheckResult { white-space: pre-wrap; color: var(--ink-2); line-height: 1.8; font-size: 12px; margin-top: 12px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Three quiet stages; the manuscript stays at the centre of the room. */
#app { grid-template-columns: minmax(0,1fr); grid-template-rows: 76px 58px minmax(0,1fr); }
.topbar, .studio-workflow, .layout { grid-column: 1; }
.topbar { gap: 12px; }
.topbar .project-heading { max-width: 360px; flex: 1 1 180px; }
.model-chip, #btnShowConsole, #btnSidebar { display: none !important; }
.topbar #btnAssets { white-space: nowrap; }
.studio-stages { gap: 18px; }
.studio-stages button { min-height: 38px; font-size: 12px; padding: 6px 4px; }
.studio-stages button span { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 7px; border: 1px solid #dce0d5; border-radius: 50%; font-size: 10px; color: #7b8980; }
.studio-stages button.active span, .studio-stages button.on span { background: #b74829; border-color: #b74829; color: #fffdf8; }
.studio-stages i { font-size: 12px; color: #d5d7ce; }
.studio-mode label { display: block; font-size: 10px; }
.studio-mode .btn { font-size: 10px; }
.studio-mode .btn::after, #btnSaveWorkspace::after { content: none; }
.studio-mode select { width: 106px; max-width: 106px; }
.studio-save { gap: 6px; min-width: 0; }
.studio-save #saveStatus { display: block; max-width: 180px; font-size: 10px; }
#btnSaveWorkspace { display: none; font-size: 10px; white-space: nowrap; }
.studio-save:has(#saveStatus[data-status="error"]) #btnSaveWorkspace { display: inline-flex; }
#saveStatus[data-status="error"] { color: #ac442b; }
.layout, .layout.no-console { grid-template-columns: 230px minmax(0,1fr); }
.sidebar { position: relative; top: auto; left: auto; bottom: auto; width: auto; transform: none; box-shadow: none; z-index: auto; }
.sidebar .tabs { display: none !important; }
.sidebar > [data-pane="chapters"] { display: block; }
.library-heading { padding: 22px 18px 17px; }
.library-heading h2 { font-size: 19px; }
.sidebar .pane-actions { gap: 8px; margin-bottom: 20px; }
.sidebar #btnPlanChapters { background: #eef0e6; border-color: #d9dfd1; color: #49604c; }
.sidebar #btnPlanChapters:hover { background: #e3e9da; }
.work { min-width: 0; display: flex; flex-direction: column; }
.work-head { padding: 16px 28px; }
.work-body { padding-bottom: 28px; }
#btnSidebar2 { display: none !important; }
#app[data-flow="setup"] .layout, #app[data-flow="outline"] .layout { grid-template-columns: minmax(0,1fr); }
#app[data-flow="setup"] .sidebar, #app[data-flow="outline"] .sidebar,
#app[data-flow="setup"] .work-head, #app[data-flow="outline"] .work-head,
#app[data-flow="setup"] .work-body, #app[data-flow="outline"] .work-body,
#app[data-flow="setup"] #writingActions, #app[data-flow="outline"] #writingActions { display: none !important; }
.flow-panel { width: 100%; flex: 1; min-height: 0; padding: 38px max(32px,calc((100% - 820px)/2)) 28px; overflow: auto; background: #f8f6ef; }
.flow-panel-head { padding-bottom: 26px; margin-bottom: 25px; border-bottom: 1px solid #dfe0d5; }
.flow-panel-head .eyebrow { color: #a56243; font-size: 9px; letter-spacing: 2px; }
.flow-panel-head h1 { font-family: var(--serif); font-size: 32px; font-weight: 500; line-height: 1.5; letter-spacing: 1px; margin: 12px 0 7px; }
.flow-panel-head p { font-size: 12px; color: #778173; margin: 0; line-height: 1.8; }
.flow-panel .pane { display: block; padding: 0; overflow: visible; }
.flow-basic-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 17px 22px; }
.flow-basic-grid > .fld { margin: 0; }
.flow-basic-grid > .flow-wide { grid-column: 1 / -1; }
.flow-advanced > summary span { color: #82907b; font-size: 11px; margin-left: 8px; }
.flow-tools-backdrop { position: fixed; inset: 0; z-index: 59; border: 0; background: #142b3333; cursor: default; }
.flow-chapters-backdrop { position: fixed; inset: 0; z-index: 49; border: 0; background: #142b3326; cursor: default; }
.flow-close-chapters { display: none; }
.sidebar #btnPlanChapters { display: none; }
.sidebar .pane-actions .row2 { grid-template-columns: 1fr; }
.flow-panel .fld { min-width: 0; margin-bottom: 17px; }
.flow-panel .fld input, .flow-panel .fld select, .flow-panel .fld textarea { width: 100%; min-width: 0; background: #fffdf7; border-color: #d7ddcf; padding: 11px 12px; font-size: 13px; }
.flow-panel .lbl { color: #4b6151; font-size: 11px; margin-bottom: 7px; }
.flow-panel .fld textarea { min-height: 100px; line-height: 1.8; }
.flow-panel .sec-title { color: #4b6151; font-size: 13px; padding-top: 13px; }
.flow-panel .note { font-size: 11px; line-height: 1.8; background: #eff0e6; border-color: #e0e4d7; }
.flow-panel .chips { gap: 7px; }
.flow-panel-foot { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-top: 26px; margin-top: 25px; border-top: 1px solid #dfe0d5; }
.flow-panel-foot > span { color: #7e8a79; font-size: 11px; line-height: 1.8; }
.flow-panel-foot .btn { padding: 12px 19px; font-size: 12px; flex-shrink: 0; }
.flow-advanced { border: 1px solid #dce0d2; border-radius: 5px; background: #f4f4e9; padding: 0 18px; margin-top: 25px; }
.flow-advanced > summary { color: #637360; cursor: pointer; padding: 16px 0; font-size: 12px; }
.flow-advanced[open] > summary { margin-bottom: 10px; border-bottom: 1px solid #dce0d2; }
.flow-plan-summary { line-height: 1.9; color: #65755f; font-size: 12px; overflow-wrap: anywhere; }
.flow-plan-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 22px 0; }
.flow-plan-actions .btn { min-height: 40px; padding: 10px 16px; font-size: 12px; }
.flow-plan-list { display: grid; gap: 10px; }
.flow-plan-item { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 3px 16px; text-align: left; cursor: pointer; border: 1px solid #dce1d3; background: #fffdf7; border-radius: 5px; padding: 17px 19px; min-width: 0; overflow-wrap: anywhere; }
.flow-plan-item > .flow-plan-meta, .flow-plan-item > .flow-plan-title, .flow-plan-item > .flow-plan-hints { grid-column: 1; }
.flow-plan-item > span:last-child { grid-column: 2; grid-row: 1 / span 3; align-self: center; }
.flow-plan-item:hover { border-color: #b8c2ad; background: #fffef9; }
.flow-plan-title { color: #2c4838; font-size: 14px; font-weight: 500; }
.flow-plan-meta { color: #83907c; font-size: 10px; margin: 5px 0; }
.flow-plan-hints { color: #6e7e67; font-size: 12px; line-height: 1.8; white-space: pre-wrap; margin: 8px 0 0; }
.flow-plan-empty { padding: 44px 25px; border: 1px dashed #d2dac8; border-radius: 5px; text-align: center; color: #829276; line-height: 1.9; font-size: 12px; }
.writing-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 10px; padding: 13px 28px; background: #faf8f1; border-top: 1px solid #dedfd2; }
.writing-actions .btn { min-height: 39px; font-size: 12px; padding: 10px 16px; white-space: nowrap; }
.writing-actions #btnWrite { min-width: 146px; display: inline-flex; gap: 30px; }
.writing-actions #btnContinue { min-width: 146px; }
.writing-actions #btnAdvancedTools { margin-left: auto; border-color: transparent; color: #697764; }
#console { position: fixed; top: 0; right: 0; bottom: 0; left: auto; width: min(420px,90vw); height: 100dvh; z-index: 60; transform: none; border-left: 1px solid #d6ddd0; box-shadow: -18px 0 70px #20332924; }
#console:not(.open) { display: none !important; }
#console.open, .layout.no-console #console.open { display: flex !important; }
.console-head { padding: 23px 22px 20px; flex: 0 0 auto; border-bottom: 1px solid #dfe4d7; }
.console-head > span:first-child { line-height: 1.8; }
.console-head > .btn { font-size: 11px; padding: 8px; }
.console-body { padding: 7px 18px 30px; }
.tool-group { border-bottom: 1px solid #e0e4d8; }
.tool-group > summary { color: #4b6450; font-size: 12px; font-weight: 500; cursor: pointer; padding: 17px 3px; }
.tool-group[open] > summary { color: #a34d2d; }
.console .tool-group .sec { margin: 0; padding: 0 3px 20px; border: 0; }
.console .tool-group .pane { display: block; overflow: visible; padding: 0 3px 20px; }
.console .tool-group .pane .sec-title { font-size: 12px; padding-top: 14px; }
.console .tool-group .pane .note { font-size: 10px; line-height: 1.8; }
.console .tool-group .pane .fld { min-width: 0; }
.console .tool-group .pane input, .console .tool-group .pane select { min-width: 0; width: 100%; }

@media (max-width: 1100px) {
  .topbar { padding: 0 18px; gap: 8px; }
  .brand { padding-right: 12px; }
  .brand-text { font-size: 19px; }
  .topbar .project-heading { flex-basis: 120px; min-width: 90px; }
  .topbar .proj-title { font-size: 17px; }
  .studio-workflow { padding: 0 18px; gap: 10px; }
  .studio-stages { gap: 10px; }
  .studio-mode label { display: none; }
  .studio-save #saveStatus { max-width: 130px; }
  .layout, .layout.no-console { grid-template-columns: 220px minmax(0,1fr); }
  .writing-actions { padding-left: 20px; padding-right: 20px; }
  .writing-actions .btn { padding-left: 12px; padding-right: 12px; }
}
@media (max-width: 900px) {
  #app { grid-template-rows: 100px 84px minmax(0,1fr); }
  .brand { display: none; }
  .topbar { flex-wrap: wrap; align-content: center; padding: 10px 18px; gap: 7px 9px; }
  .topbar .project-heading { order: 0; flex: 1 1 calc(100% - 65px); width: 0; min-width: 0; max-width: none; }
  .project-heading > .eyebrow { display: none; }
  .topbar .proj-title { width: 100%; height: 32px; padding: 3px 5px; font-size: 19px; }
  .member-button { order: 1; margin-left: 0; flex: 0 0 auto; border: 0; padding: 0; }
  .member-avatar { width: 30px; height: 30px; }
  #memberName, .member-button > span:last-child, .tb-spacer { display: none; }
  #btnProjects { order: 2; }
  #btnAssets { order: 3; }
  #btnExport { order: 4; }
  #btnKeys { order: 5; margin-left: auto; }
  .topbar .btn { font-size: 11px; padding: 6px 9px; height: 29px; }
  .studio-workflow { padding: 4px 20px; flex-wrap: wrap; gap: 0 8px; }
  .studio-stages { flex: 1 0 100%; justify-content: flex-start; gap: 22px; }
  .studio-stages button { font-size: 12px; min-height: 37px; padding: 3px 2px; }
  .studio-stages button span { display: inline-grid; width: 20px; height: 20px; margin-right: 6px; }
  .studio-mode { margin: 0 auto 0 0; gap: 8px; }
  .studio-mode .btn { font-size: 10px; padding: 6px 2px; }
  .studio-save #saveStatus { display: block; max-width: 145px; font-size: 10px; }
  .layout, .layout.no-console { grid-template-columns: minmax(0,1fr); }
  .sidebar { position: fixed; top: 184px; left: 0; bottom: 0; width: min(290px,86vw); z-index: 50; box-shadow: 14px 12px 40px #142b3320; }
  .sidebar:not(.open) { display: none !important; }
  .sidebar.open { display: flex !important; }
  .sidebar .library-heading { position: relative; }
  .flow-close-chapters { display: inline-flex; position: absolute; right: 12px; top: 13px; }
  #app[data-flow="write"] #btnSidebar2 { display: inline-flex !important; }
  .work-head { padding: 13px 20px; }
  .work-head .ch-title { flex: 1 1 180px; }
  .work-body { padding: 20px 20px 26px; }
  .flow-panel { padding: 30px max(25px,calc((100% - 760px)/2)) 25px; }
}
@media (max-width: 600px) {
  #app { grid-template-rows: 94px 84px minmax(0,1fr); }
  .topbar { padding: 7px 12px; gap: 6px 7px; }
  .topbar .project-heading { flex-basis: calc(100% - 50px); }
  .topbar .proj-title { font-size: 18px; }
  .topbar .btn { font-size: 10px; padding: 5px 8px; }
  .studio-workflow { padding: 3px 14px; }
  .studio-stages { gap: 18px; }
  .studio-stages i { font-size: 10px; }
  .studio-save #saveStatus { display: block; max-width: 122px; font-size: 9px; }
  .studio-mode { gap: 6px; }
  .studio-mode select { width: 95px; max-width: 95px; padding: 4px 7px; }
  .studio-mode .btn { font-size: 9px; padding-left: 0; }
  #btnSaveWorkspace { padding: 4px; font-size: 9px; }
  .sidebar { top: 178px; }
  .work-head { min-height: 88px; padding: 10px 13px; gap: 5px 8px; }
  .work-head #btnSidebar2 { font-size: 10px; padding: 5px 6px; }
  .work-head .ch-title { flex: 1 1 0; width: 0; min-width: 0; font-size: 17px; }
  .work-body { padding: 14px 11px 22px; }
  .writing-actions { padding: 10px 11px max(10px,env(safe-area-inset-bottom)); gap: 5px; }
  .writing-actions .btn { min-height: 38px; padding: 8px 9px; font-size: 11px; }
  .writing-actions #btnWrite, .writing-actions #btnContinue { min-width: 112px; gap: 16px; }
  .writing-actions #btnAdvancedTools { padding-left: 5px; padding-right: 3px; font-size: 10px; }
  .flow-panel { padding: 26px 19px 23px; }
  .flow-panel-head { padding-bottom: 21px; margin-bottom: 21px; }
  .flow-panel-head h1 { font-size: 27px; margin-top: 10px; }
  .flow-panel-head p { font-size: 11px; }
  .flow-basic-grid { grid-template-columns: minmax(0,1fr); gap: 15px; }
  .flow-panel .fld input, .flow-panel .fld select, .flow-panel .fld textarea { font-size: 16px; }
  .flow-panel-foot { align-items: stretch; flex-direction: column; gap: 13px; padding-top: 21px; margin-top: 21px; }
  .flow-panel-foot .btn { justify-content: center; }
  .flow-panel-foot > span { font-size: 10px; }
  .flow-advanced { padding: 0 13px; }
  .flow-plan-actions { gap: 8px; }
  .flow-plan-actions .btn { font-size: 11px; padding: 9px 12px; }
  .flow-plan-item { padding: 15px; }
  #console { width: min(420px,94vw); }
  .console-head { padding: 19px 16px 16px; }
  .console-body { padding-left: 13px; padding-right: 13px; }
}
