:root{--bg:#f7f5f0;--sheet:#fefdfb;--panel:#fffefa;--subtle:#efede7;--ink:#34373b;--muted:#888b8b;--line:#dedbd4;--accent:#81766b;--accent-wash:#e9e4dc;--editor-size:17px;--editor-line:1.6;--editor-family:'Hiragino Kaku Gothic ProN','Yu Gothic',-apple-system,BlinkMacSystemFont,'Noto Sans JP',sans-serif;--surface-shadow:0 5px 20px rgba(35,33,35,.04)}
*{box-sizing:border-box}html,body{height:100%;margin:0}body{background:var(--bg);color:var(--ink);font-family:-apple-system,BlinkMacSystemFont,'Hiragino Kaku Gothic ProN','Yu Gothic',sans-serif;font-size:14px;-webkit-font-smoothing:antialiased}button,input,textarea,select{font:inherit}button{cursor:pointer}button:disabled{cursor:not-allowed;opacity:.38}input,textarea,select{color:var(--ink);outline:none}button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:2px solid var(--accent);outline-offset:2px}::selection{background:var(--accent-wash)}.hidden{display:none!important}.app-shell{height:100dvh;display:grid;grid-template-columns:252px 196px minmax(0,1fr);grid-template-rows:68px minmax(0,1fr);overflow:hidden}.app-shell.focus{grid-template-columns:minmax(0,1fr)}.app-shell.focus .main-top{grid-column:1}.app-shell.focus .rail,.app-shell.focus .pages-rail{display:none}.app-shell.focus .workspace{grid-column:1}.main-top{grid-column:1 / -1;display:flex;justify-content:space-between;align-items:center;padding:0 27px;gap:20px;background:var(--sheet);border-bottom:1px solid var(--line);z-index:5}.brand-group{display:flex;align-items:center;gap:0;min-width:112px;flex:0 0 auto}.brand-word{display:flex;flex-direction:column;gap:2px}.brand-word b{font-family:Georgia,serif;letter-spacing:.015em;font-size:18px;font-weight:500}.brand-word small{font-size:9px;letter-spacing:.18em;color:var(--muted)}.top-mid{display:flex;align-items:center;gap:7px;min-width:0;color:var(--muted);font-size:12px}.top-mid strong{color:var(--ink);font-weight:600;max-width:210px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.top-actions{display:flex;align-items:center;gap:8px;flex-shrink:0}.save-indicator{font-size:11px;display:flex;align-items:center;gap:6px;color:var(--muted);margin-right:4px}.save-dot{width:6px;height:6px;border-radius:100%;background:#88a48e}.save-dot.wait{background:#c39f60}.save-dot.bad{background:#ba6868}.icon-btn{background:transparent;color:var(--muted);width:36px;height:36px;border:1px solid transparent;border-radius:11px;display:inline-grid;place-items:center;font-size:17px;flex-shrink:0}.icon-btn:hover,.icon-btn.active{background:var(--subtle);color:var(--ink)}.btn{border:1px solid var(--line);background:transparent;border-radius:10px;min-height:34px;padding:8px 12px;color:var(--ink);display:inline-flex;gap:7px;align-items:center;justify-content:center;font-size:12px;font-weight:600;transition:background .1s}.btn:hover{background:var(--subtle)}.btn.primary{background:var(--ink);color:var(--sheet);border-color:var(--ink)}.btn.primary:hover{opacity:.9}.btn.accent{border-color:var(--accent);color:var(--accent)}.btn.soft{background:var(--accent-wash);border-color:transparent}.btn.xs{font-size:11px;padding:6px 8px;min-height:29px}.btn.block{width:100%}.rail{grid-column:1;grid-row:2;background:var(--sheet);border-right:1px solid var(--line);display:flex;flex-direction:column;overflow-y:auto;padding:25px 14px 15px}.rail-head,.pages-rail-head{display:flex;align-items:center;justify-content:space-between;margin:0 10px 16px}.eyebrow{font-size:10px;letter-spacing:.14em;font-weight:700;color:var(--muted)}.rail-filter{display:flex;align-items:center;gap:8px;border:1px solid var(--line);border-radius:11px;margin:0 8px 18px;padding:9px 10px;background:var(--bg);color:var(--muted)}.rail-filter input{background:transparent;border:0;width:100%;font-size:12px;min-width:0}.rail-list{display:flex;flex-direction:column;gap:5px}.folder-line{font-size:11px;letter-spacing:.07em;color:var(--muted);display:flex;align-items:center;gap:8px;padding:11px 11px 6px}.project-item{border:1px solid transparent;width:100%;text-align:left;display:flex;gap:10px;align-items:center;padding:12px 11px;border-radius:11px;color:var(--ink);background:transparent}.project-item:hover{background:var(--bg)}.project-item.active{background:var(--accent-wash);border-color:var(--line)}.project-symbol{height:32px;width:32px;border-radius:10px;flex-shrink:0;background:var(--accent-wash);color:var(--accent);display:grid;place-items:center;font-family:Georgia,serif}.project-info{display:flex;flex-direction:column;gap:3px;min-width:0}.project-info strong{font-size:12px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.project-info small{color:var(--muted);font-size:10px}.rail-foot{border-top:1px solid var(--line);margin-top:auto;padding:16px 8px 0;color:var(--muted);font-size:10px;line-height:1.8}.rail-footer-buttons{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:13px}.pages-rail{grid-column:2;grid-row:2;background:var(--bg);border-right:1px solid var(--line);display:flex;flex-direction:column;padding:28px 13px;overflow:auto}.episode-label{padding:0 9px;margin-bottom:20px}.episode-label span{display:block;font-size:11px;color:var(--muted);margin-bottom:7px}.episode-label b{font-size:16px;font-weight:650;line-height:1.5}.episode-label small{display:block;color:var(--muted);margin-top:5px;font-size:11px}.episode-list{display:flex;flex-direction:column;gap:4px;margin-bottom:16px}.episode-item{font-size:12px;text-align:left;border:0;border-radius:9px;padding:9px 12px;background:transparent;color:var(--muted)}.episode-item.active{background:var(--sheet);color:var(--ink);box-shadow:var(--surface-shadow);font-weight:600}.episode-item:hover{color:var(--ink)}.page-header-row{display:flex;align-items:center;justify-content:space-between;margin:0 9px 10px}.page-stack{display:flex;flex-direction:column;gap:6px}.page-item{display:flex;flex-direction:column;text-align:left;gap:3px;padding:12px 13px;border:1px solid transparent;border-radius:11px;background:transparent;color:var(--ink)}.page-item.active{background:var(--sheet);border-color:var(--line);box-shadow:var(--surface-shadow)}.page-item:hover{background:var(--sheet)}.page-item strong{font-size:13px}.page-item small{color:var(--muted);font-size:10px}.page-item .page-bars{display:flex;gap:3px;margin-top:7px}.page-bars i{height:3px;width:16px;border-radius:3px;background:#c6bdb4}.page-item.active .page-bars i{background:var(--accent)}.add-page{color:var(--accent);border-style:dashed;margin-top:10px;align-items:center;flex-direction:row;justify-content:center;padding:11px;font-size:11px}.page-mobile-strip{display:none}.workspace{grid-column:3;grid-row:2;overflow-y:auto;overflow-x:hidden;scroll-behavior:smooth;position:relative;padding:30px 5vw 100px}.editor-inner{max-width:880px;margin:0 auto}.editor-top{display:flex;align-items:start;justify-content:space-between;gap:12px;margin-bottom:24px}.section-kicker{color:var(--accent);letter-spacing:.19em;font-size:10px;font-weight:800;text-transform:uppercase;display:block;margin-bottom:10px}.page-title{font-family:Georgia,'Hiragino Mincho ProN','Yu Mincho',serif;font-size:30px;line-height:1.3;font-weight:500;letter-spacing:.005em;margin:0}.page-sub{color:var(--muted);font-size:11px;line-height:1.6;margin-top:8px}.editor-options{display:flex;align-items:center;gap:4px;flex-shrink:0}.reading-lane{background:var(--sheet);border:1px solid var(--line);border-radius:17px;box-shadow:var(--surface-shadow);padding:36px clamp(22px,5vw,62px) 39px}.block-eyebrow{color:var(--accent);font-size:10px;font-weight:700;letter-spacing:.09em}.scene-editor{position:relative;margin-bottom:25px}.scene-editor::before{content:'';position:absolute;left:-19px;top:7px;height:calc(100% - 14px);background:var(--accent);width:2px;border-radius:2px;opacity:.55}.block-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:9px}.block-head .label{display:flex;align-items:center;gap:7px;color:var(--muted);font-size:10px;font-weight:700;letter-spacing:.06em}.tool-row{display:flex;align-items:center;gap:2px;opacity:.55;transition:opacity .12s}.scene-editor:hover .tool-row,.panel-card:hover .tool-row,.tool-row:focus-within{opacity:1}.tiny-btn{height:29px;width:29px;border:0;border-radius:7px;background:transparent;display:grid;place-items:center;color:var(--muted);font-size:13px}.tiny-btn:hover{background:var(--subtle);color:var(--ink)}.tiny-btn.danger:hover{background:#f8e5e5;color:#9b3f3f}.write-area{font-family:var(--editor-family);font-size:var(--editor-size);line-height:var(--editor-line);color:var(--ink);border:1px solid transparent;border-radius:9px;background:transparent;padding:12px 13px;width:100%;resize:vertical;min-height:54px;overflow-y:hidden;transition:background .1s,border .1s;white-space:pre-wrap}.write-area:hover{background:var(--bg)}.write-area:focus{background:var(--bg);border-color:var(--accent)}.write-area::placeholder{color:var(--muted);opacity:.55}.scene-editor .write-area{font-size:calc(var(--editor-size) * .87);border-bottom:1px solid var(--line);border-radius:0}.panel-card{border:1px solid var(--line);border-radius:13px;padding:19px 19px 16px;margin-bottom:18px;background:var(--panel);transition:border-color .1s}.panel-card:focus-within{border-color:var(--accent)}.panel-card .panel-name{font-weight:700;color:var(--accent);font-size:11px;letter-spacing:.06em}.panel-card .stage-area{margin:0 0 8px}.field-label{font-size:10px;font-weight:700;letter-spacing:.06em;color:var(--muted);margin:2px 0 3px}.dialogue-list{display:flex;flex-direction:column;gap:8px}.dialogue-row{display:grid;grid-template-columns:136px minmax(0,1fr) 25px;gap:10px;align-items:start}.speaker-select{background:var(--bg);border:1px solid var(--line);padding:12px 6px 12px 10px;border-radius:9px;min-height:46px;width:100%;font-size:12px}.dialogue-row .write-area{background:var(--bg);border:1px solid transparent;padding:9px 11px;min-height:46px}.dialogue-row .write-area:focus{border-color:var(--accent)}.dialogue-row .tiny-btn{margin-top:7px}.editor-inline-add{border:1px dashed var(--line);background:transparent;color:var(--accent);border-radius:9px;padding:7px 12px;font-size:11px;display:inline-flex;align-items:center;gap:6px;margin-top:10px}.editor-inline-add:hover{background:var(--bg)}.note-area{margin-top:14px;border-top:1px solid var(--line);padding-top:13px}.note-area textarea{font-size:calc(var(--editor-size)*.83);min-height:45px}.bottom-tools{display:flex;justify-content:center;gap:10px;padding:22px 0 6px;flex-wrap:wrap}.bottom-tools .btn{border-style:dashed;min-width:130px}.footer-nav{display:flex;justify-content:space-between;align-items:center;margin-top:24px}.page-progress{color:var(--muted);font-size:11px}.empty-state{text-align:center;padding:14vh 10px 10vh}.empty-emblem{width:70px;height:70px;display:grid;place-items:center;border:1px solid var(--line);border-radius:22px;margin:0 auto 21px;font-family:Georgia,serif;font-size:32px;color:var(--accent);background:var(--sheet)}.empty-state h1{font-size:25px;font-family:Georgia,'Yu Mincho',serif;font-weight:500}.empty-state p{font-size:13px;color:var(--muted);line-height:2;margin:15px auto 22px;max-width:440px}.project-home{max-width:780px;margin:35px auto}.project-home h1{font-size:30px;font-family:Georgia,'Yu Mincho',serif;font-weight:500;line-height:1.45;margin:0 0 7px}.project-home p{color:var(--muted);font-size:12px;line-height:1.8}.project-home-heading{display:flex;justify-content:space-between;align-items:center;gap:20px;margin:28px 0 12px}.home-episode{display:flex;align-items:center;justify-content:space-between;gap:15px;background:var(--sheet);border:1px solid var(--line);border-radius:13px;padding:18px;margin-bottom:11px}.home-episode h3{font-size:15px;margin:0 0 5px}.home-episode small{font-size:11px;color:var(--muted)}.status-tag{display:inline-block;padding:5px 9px;font-size:10px;border-radius:6px;background:var(--accent-wash);color:var(--accent)}.floating-panel{position:fixed;z-index:55;right:21px;top:80px;width:360px;max-height:calc(100dvh - 92px);overflow:auto;border:1px solid var(--line);border-radius:18px;background:var(--sheet);box-shadow:0 20px 70px rgba(0,0,0,.16);padding:22px}.settings-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:22px}.settings-head h2{font-family:Georgia,'Yu Mincho',serif;font-size:21px;font-weight:500;margin:0}.settings-group{margin-bottom:23px}.settings-group label{display:block;font-size:11px;font-weight:700;margin-bottom:11px}.theme-choices{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:11px 9px}.theme-option{border:0;background:transparent;text-align:center;font-size:9px;color:var(--muted);padding:0}.theme-option .swatch{height:53px;width:100%;border:2px solid transparent;border-radius:10px;display:flex;flex-direction:column;gap:6px;align-items:flex-start;padding:13px 10px}.theme-option .swatch i{height:4px;border-radius:3px;width:70%}.theme-option .swatch i+i{width:50%;opacity:.55}.theme-option.active .swatch{outline:2px solid var(--accent);outline-offset:2px}.theme-option strong{display:block;margin-top:7px;font-weight:600;font-size:10px;line-height:1.3;white-space:nowrap}.settings-group select,.settings-group input[type=range]{width:100%}.settings-group select{background:var(--bg);border:1px solid var(--line);padding:11px;border-radius:10px}.settings-range{display:flex;align-items:center;gap:10px}.settings-range input{accent-color:var(--accent)}.settings-range output{font-size:12px;font-weight:700;min-width:37px}.modal-scrim{position:fixed;inset:0;z-index:60;background:rgba(33,32,35,.36);display:grid;place-items:center;padding:15px;overflow:auto}.modal-window{width:min(520px,100%);max-height:92dvh;overflow:auto;background:var(--sheet);border:1px solid var(--line);border-radius:18px;box-shadow:0 24px 90px rgba(0,0,0,.17);padding:26px}.modal-window.wide{width:min(710px,100%)}.modal-window h2{font-size:23px;font-family:Georgia,'Yu Mincho',serif;margin:0 0 8px;font-weight:500}.modal-window p{font-size:12px;line-height:1.8;color:var(--muted);margin:0 0 19px}.modal-label{display:block;font-size:11px;font-weight:700;margin:16px 0 7px}.modal-input{width:100%;background:var(--bg);border:1px solid var(--line);padding:12px 13px;border-radius:10px;font-size:14px}.modal-buttons{display:flex;gap:9px;justify-content:flex-end;margin-top:24px}.modal-list{display:flex;flex-wrap:wrap;gap:8px}.modal-pill{border:1px solid var(--line);padding:8px 10px;border-radius:9px;font-size:12px;display:flex;gap:9px;align-items:center}.modal-pill button{border:0;color:var(--muted);background:none;font-size:15px;cursor:pointer}.preview-table{border-collapse:collapse;width:100%;font-size:11px}.preview-table th,.preview-table td{border:1px solid var(--line);padding:8px;vertical-align:top;white-space:pre-wrap;overflow-wrap:anywhere}.preview-table th{background:var(--subtle);font-size:10px}.warnings{background:var(--accent-wash);border-radius:10px;padding:14px;margin:12px 0;font-size:12px;line-height:1.7}.muted{color:var(--muted)}.danger-text{color:#9a4848}.stat-list{display:flex;gap:10px;flex-wrap:wrap}.stat{padding:13px 14px;background:var(--bg);border:1px solid var(--line);border-radius:12px;flex:1;text-align:center;min-width:85px}.stat strong{display:block;font-family:Georgia,serif;font-weight:500;font-size:21px}.stat small{font-size:10px;color:var(--muted)}#toast{position:fixed;z-index:110;bottom:25px;left:50%;transform:translate(-50%,20px);background:#33343a;color:#fff;padding:11px 17px;border-radius:10px;opacity:0;pointer-events:none;transition:.2s;font-size:12px;box-shadow:0 6px 22px #0002}#toast.show{opacity:1;transform:translate(-50%,0)}.loading-screen{padding:28vh 0;text-align:center;font:26px Georgia,serif;color:#81766b}.loading-screen small{display:block;font:12px sans-serif;margin-top:20px;color:#888}
@media(max-width:1199px){.app-shell{grid-template-columns:185px minmax(0,1fr)}.rail{display:none}.pages-rail{grid-column:1}.workspace{grid-column:2;padding:27px 3.8vw 90px}.main-top{padding:0 18px}.top-mid{display:none}.reading-lane{padding:29px 32px}}
@media(max-width:767px){.app-shell{display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:61px minmax(0,1fr)}.main-top{padding:0 11px}.brand-word b{font-size:15px}.brand-word small{font-size:8px}.brand-group{min-width:auto;gap:0}.save-indicator{display:none}.top-actions{gap:1px}.top-actions .btn{font-size:10px;padding:7px 8px;min-height:32px}.pages-rail{display:none}.workspace{grid-column:1;grid-row:2;padding:23px 12px 70px}.editor-top{margin-bottom:16px;align-items:center}.page-title{font-size:24px}.reading-lane{padding:22px 13px;border-radius:13px}.panel-card{padding:14px 10px 13px;margin-bottom:13px}.dialogue-row{grid-template-columns:94px minmax(0,1fr) 24px;gap:5px}.speaker-select{padding:10px 4px;min-height:43px;font-size:11px}.write-area{padding:10px 6px}.dialogue-row .write-area{padding:9px 6px}.panel-card .tool-row{opacity:1}.footer-nav{margin-top:12px}.floating-panel{left:0;right:0;top:auto;bottom:0;max-height:82dvh;width:100%;border-radius:21px 21px 0 0;padding:22px 22px max(25px,env(safe-area-inset-bottom))}.home-episode{align-items:start;flex-direction:column}.project-home{margin:20px auto}.project-home h1{font-size:24px}.page-mobile-strip{display:flex;gap:8px;overflow:auto;margin-bottom:19px;scrollbar-width:none}.page-mobile-strip .btn{white-space:nowrap}.page-mobile-strip .active{background:var(--ink);color:var(--sheet)}.modal-window{padding:21px}.modal-scrim{place-items:end center;padding:0}.modal-window{width:100%;border-radius:22px 22px 0 0;max-height:93dvh}.modal-window.wide{width:100%}.preview-table{font-size:10px}}

.rail-manage{display:grid;gap:7px;margin-top:25px;padding:14px 4px;border-top:1px solid var(--line)}.rail-manage .btn{font-size:10px;justify-content:flex-start}
@media(max-width:767px){.brand-word{white-space:nowrap}.brand-word b{font-size:14px}.brand-word small{display:none}.top-actions [data-action="undo"],.top-actions [data-action="redo"]{display:none}.top-actions .icon-btn{width:32px}}

/* Alpha 0.3: cloud connection and conflict-resolution controls. */
.cloud-button{width:40px!important;white-space:nowrap}.cloud-state{border:1px solid var(--line);padding:14px;border-radius:12px;background:var(--bg);margin:12px 0 16px;display:flex;flex-direction:column;gap:8px}.cloud-state b{font-size:14px;color:var(--ink)}.cloud-state small{font-size:12px;line-height:1.65;color:var(--muted);overflow-wrap:anywhere}.cloud-actions{display:flex;flex-direction:column;gap:9px;margin:15px 0}.cloud-privacy{margin-top:16px!important;font-size:11px!important}.cloud-hint{margin-top:10px!important;font-size:11px!important}.cloud-status-live{color:var(--muted);font-size:11px;line-height:1.7;min-height:14px}.cloud-panel button{min-height:38px}@media(max-width:767px){.top-actions .cloud-button{width:32px!important}.top-actions [data-action="focus"]{display:none}}

.otp-details{border:1px solid var(--line);border-radius:11px;padding:12px;margin:12px 0}.otp-details summary{cursor:pointer;font-size:12px;font-weight:600;color:var(--accent)}.otp-details[open] summary{margin-bottom:9px}

/* Alpha 0.3.3: one-off speakers without adding to the character dictionary. */
.speaker-column{min-width:0;width:100%;}
.speaker-manual-wrap{display:flex;flex-direction:column;gap:4px;min-width:0;}
.speaker-manual{display:block;width:100%;min-width:0;min-height:46px;padding:10px 9px;background:var(--bg);color:var(--ink);border:1px solid var(--accent);border-radius:9px;font-size:12px;}
.speaker-manual::placeholder{color:var(--muted);font-size:11px;}
.speaker-switch{display:block;align-self:start;padding:3px 2px;border:0;background:transparent;font-size:10px;line-height:1.4;color:var(--accent);text-align:left;cursor:pointer;}
.speaker-switch:hover{text-decoration:underline;}
@media(max-width:767px){.dialogue-row{grid-template-columns:minmax(110px,36%) minmax(0,1fr) 24px;gap:5px}.speaker-manual{padding:10px 5px;font-size:12px}.speaker-switch{font-size:10px;letter-spacing:-.02em}}

/* Alpha 0.4 — template-based read-only submission preview */
.modal-window.wide{width:min(1100px,calc(100vw - 32px));}
.export-lead{margin-bottom:13px!important;}
.export-success{margin:14px 0;padding:12px 14px;background:var(--subtle);border-radius:10px;font-size:12px;}
.export-warnings{padding:12px 14px;}
.warning-entries{display:grid;gap:5px;max-height:110px;overflow:auto;margin-top:7px;}
.warning-jump{border:0;background:transparent;text-align:left;padding:5px 0;color:var(--ink);font-size:11px;cursor:pointer;display:flex;justify-content:space-between;gap:10px;}
.warning-jump span{color:var(--accent);white-space:nowrap;}
.warning-static{padding:4px 0;font-size:11px;}
.preview-section-head{display:flex;justify-content:space-between;align-items:center;margin:17px 0 8px;gap:10px;}
.preview-section-head .eyebrow{font-size:9px;margin-bottom:2px;}
.preview-section-head b{font-weight:600;font-size:14px;}
.preview-section-head .muted{font-size:11px;margin-left:12px;}
.preview-nav-controls{display:flex;gap:6px;}
.preview-nav-controls button:disabled{opacity:.35;cursor:default;}
.preview-pages{display:flex;gap:6px;overflow-x:auto;scrollbar-width:thin;padding:6px 0 10px;}
.preview-page-btn{flex:none;border:1px solid var(--line);background:var(--sheet);padding:6px 11px;border-radius:7px;font-size:11px;color:var(--ink);cursor:pointer;}
.preview-page-btn.current{background:var(--ink);border-color:var(--ink);color:var(--sheet);}
.modal-window .preview-hint{font-size:11px;line-height:1.6;margin-bottom:9px;}
.sheet-preview{max-height:min(47dvh,490px);overflow:auto;overscroll-behavior:contain;border:1px solid #dadada;border-radius:9px;background:#fff;color:#222;}
.sheet-grid{table-layout:fixed;border-collapse:separate;border-spacing:0;min-width:1020px;width:100%;font-family:'Arial','Hiragino Kaku Gothic ProN','Yu Gothic',sans-serif;font-size:11px;line-height:1.43;color:#262626;}
.sheet-grid .sheet-index-col{width:38px;}.sheet-grid .sheet-col-a{width:84px;}.sheet-grid .sheet-col-b{width:27px;}.sheet-grid .sheet-col-c{width:402px;}.sheet-grid .sheet-col-d{width:106px;}.sheet-grid .sheet-col-e{width:114px;}.sheet-grid .sheet-col-f{width:289px;}
.sheet-grid td,.sheet-grid th{border-right:1px solid #dedede;border-bottom:1px solid #dedede;padding:3px 5px;vertical-align:bottom;white-space:pre-wrap;overflow-wrap:anywhere;font-weight:400;background:#fff;}
.sheet-grid tr{height:24px;}
.sheet-grid thead th{position:sticky;top:0;z-index:2;text-align:center;background:#f2f2f2;color:#555;vertical-align:middle;font-size:10px;height:25px;}
.sheet-grid .sheet-line{position:sticky;left:0;z-index:1;background:#f2f2f2;color:#777;vertical-align:middle;text-align:center;font-size:10px;}
.sheet-grid thead .sheet-corner{z-index:3;left:0;}
.sheet-grid tr.sheet-heading td{text-align:center;background:#fafafa;}
.sheet-grid .sheet-page-break td{background:#fafafa;}
.sheet-grid .sheet-center{text-align:center;}
.export-modal-footer{display:flex;gap:9px;justify-content:flex-end;margin-top:15px;flex-wrap:wrap;}
@media(max-width:767px){.modal-window.wide{width:100%;}.preview-nav-controls button{padding:6px 9px;min-height:32px;}.sheet-preview{max-height:44dvh;}.preview-section-head .muted{display:block;margin-left:0;margin-top:2px;}.export-modal-footer .btn.primary{flex:1;}.stat{padding:10px 8px;min-width:65px;}.stat strong{font-size:17px;}.stat small{font-size:9px;}}

.sheet-grid td.sheet-meta-cell{white-space:nowrap;overflow:hidden;text-overflow:clip;}

/* Alpha 0.5 — legible, uncluttered nine-theme palette, including iPhone bottom sheet. */
.theme-option{min-width:0;}.theme-option .swatch{height:48px;}.theme-option:focus-visible{outline:2px solid var(--accent);outline-offset:3px;border-radius:10px;}
@media(max-width:360px){.theme-choices{gap:9px 5px}.theme-option strong{font-size:9px;}}

/* Alpha 0.6 — calm, responsive page overview. Read-only, no editor input rerender. */
.rail-outline-link{display:flex;align-items:center;justify-content:space-between;width:calc(100% - 24px);margin:3px 12px 10px;padding:10px 12px;text-align:left;border:1px solid var(--line);border-radius:10px;background:var(--sheet);color:var(--accent);font-size:11px;font-weight:600;cursor:pointer}
.rail-outline-link:hover,.outline-top-btn:hover{background:var(--subtle)}
.outline-strip-btn{border-color:var(--accent)!important;color:var(--accent)!important}
.outline-top-btn{white-space:nowrap;font-weight:600}
.outline-window{width:min(1120px,calc(100vw - 30px))!important;max-height:92dvh;overscroll-behavior:contain}
.outline-window>h2{font-size:20px;margin-bottom:6px}
.outline-intro{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;margin:10px 0 18px}
.outline-intro h3{font-family:Georgia,'Yu Mincho',serif;font-size:21px;font-weight:500;line-height:1.35;margin:6px 0 6px;color:var(--ink)}
.outline-intro p{font-size:11px;line-height:1.6;margin:0;color:var(--muted)}
.outline-intro .btn{white-space:nowrap;flex-shrink:0}
.outline-stats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:9px;margin-bottom:19px}
.outline-stats>div{display:grid;gap:3px;padding:13px 14px;border:1px solid var(--line);background:var(--bg);border-radius:12px;text-align:center}
.outline-stats strong{font-size:22px;font-family:Georgia,serif;font-weight:500;color:var(--ink)}
.outline-stats small{font-size:10px;color:var(--muted)}
.outline-toolbar{display:flex;gap:12px;align-items:center;justify-content:space-between;margin-bottom:15px}
.outline-switch{display:flex;gap:3px;align-items:center;border:1px solid var(--line);background:var(--subtle);border-radius:9px;padding:3px}
.outline-switch button{border:0;border-radius:6px;padding:8px 17px;background:transparent;color:var(--muted);font-size:11px;cursor:pointer}
.outline-switch button.active{background:var(--sheet);color:var(--ink);box-shadow:0 1px 6px #00000012;font-weight:700}
.outline-hint{font-size:11px;color:var(--muted)}
.outline-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:13px}
.outline-grid.detail-mode{grid-template-columns:repeat(2,minmax(0,1fr))}
.outline-card{border:1px solid var(--line);border-radius:15px;background:var(--panel);padding:16px 16px 14px;min-width:0;display:flex;flex-direction:column;gap:12px;box-shadow:0 4px 14px #00000006}
.outline-card.is-current{border-color:var(--accent);box-shadow:0 0 0 1px var(--accent-wash) inset}
.outline-card.is-empty{background:var(--bg)}
.outline-card-head{display:flex;align-items:start;justify-content:space-between;gap:8px}
.outline-card-head>div{display:flex;align-items:center;gap:7px;flex-wrap:wrap}
.outline-page-number{font:500 24px/1.2 Georgia,serif;color:var(--ink)}
.outline-current-tag{padding:3px 7px;border-radius:99px;background:var(--accent-wash);color:var(--accent);font-size:10px;font-weight:600}
.outline-counts{font-size:10px;white-space:nowrap;color:var(--muted);margin-top:6px}
.outline-mini-label{color:var(--muted);font-size:9px;font-weight:700;letter-spacing:.05em}
.outline-scenes{display:flex;flex-direction:column;gap:6px;min-width:0}
.outline-scenes>div{display:flex;flex-wrap:wrap;gap:5px}
.outline-scene-name{display:inline-block;background:var(--subtle);border:1px solid var(--line);border-radius:7px;color:var(--ink);font-size:10px;line-height:1.5;padding:4px 6px;overflow-wrap:anywhere;white-space:pre-line}
.outline-extra{font-size:10px;color:var(--muted)}
.outline-excerpts{display:flex;flex-direction:column;gap:5px;min-width:0}
.outline-excerpts p{margin:0 0 8px;font-size:11px;line-height:1.7;color:var(--ink);min-height:18px;white-space:normal;overflow-wrap:anywhere}
.outline-empty-note{margin:5px 0;color:var(--muted);font-size:11px}
.outline-open{margin-top:auto;display:flex;align-items:center;justify-content:space-between;min-height:39px;width:100%;gap:9px;text-align:left;padding:9px 10px;background:var(--subtle);color:var(--accent);border:1px solid var(--line);border-radius:9px;cursor:pointer;font-size:11px;font-weight:600}
.outline-open:hover{border-color:var(--accent);background:var(--accent-wash)}
.outline-open span{font-size:15px}
.outline-beats{display:grid;gap:8px}
.outline-beat{display:grid;grid-template-columns:42px minmax(0,1fr);align-items:start;gap:3px 8px;border-bottom:1px solid var(--line);padding-bottom:8px}
.outline-beat>span{font-size:9px;font-weight:700;color:var(--muted);padding-top:3px}
.outline-beat p{font-size:11px;line-height:1.6;margin:0!important;color:var(--ink);overflow-wrap:anywhere}
.outline-beat small{grid-column:2;color:var(--muted);font-size:10px;line-height:1.6;overflow-wrap:anywhere}
.outline-beat-scene p{font-weight:700;color:var(--accent)}
.outline-footnote{margin:14px 0 0!important;color:var(--muted);font-size:10px!important;line-height:1.7!important}
@media(max-width:1199px){.outline-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:767px){.outline-top-btn{display:none}.outline-window{width:100%!important;max-height:94dvh;padding:19px 15px max(18px,env(safe-area-inset-bottom))!important;border-radius:21px 21px 0 0}.outline-window>h2{font-size:19px}.outline-intro h3{font-size:17px}.outline-intro .btn{padding:8px}.outline-grid,.outline-grid.detail-mode{grid-template-columns:minmax(0,1fr);gap:10px}.outline-stats{gap:6px}.outline-stats>div{padding:11px 5px}.outline-stats strong{font-size:19px}.outline-stats small{font-size:9px}.outline-card{padding:13px}.outline-hint{font-size:10px}.outline-toolbar{gap:7px}.outline-switch button{padding:8px 13px}}
@media(min-width:768px){.outline-strip-btn{display:none}}

/* Alpha 0.6.1: iPhone edge-swipe drawers; desktop/iPad remain unchanged. */
.mobile-side-scrim{display:none}
.mobile-pages-button{display:none}
@media (max-width:767px){
 html,body{overscroll-behavior-x:none}
 .mobile-pages-button{display:inline-flex;flex-shrink:0;border-color:var(--accent);color:var(--accent)}
 .mobile-side-scrim{display:block;position:fixed;inset:0;z-index:72;background:rgba(20,23,28,.42);-webkit-tap-highlight-color:transparent;overscroll-behavior:contain}
 .mobile-side-panel{position:absolute;top:0;bottom:0;width:min(340px,87vw);background:var(--sheet);color:var(--ink);display:flex;flex-direction:column;box-shadow:0 12px 38px rgba(0,0,0,.16);overflow:hidden;padding-bottom:env(safe-area-inset-bottom);touch-action:pan-y;}
 .mobile-side-left{left:0;border-right:1px solid var(--line)}
 .mobile-side-right{right:0;border-left:1px solid var(--line);background:var(--bg)}
 .mobile-side-heading{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:calc(17px + env(safe-area-inset-top)) 15px 13px;border-bottom:1px solid var(--line);background:var(--sheet);flex-shrink:0}
 .mobile-side-heading h2{font-size:19px;font-family:Georgia,'Yu Mincho',serif;font-weight:500;margin:6px 0 0}
 .mobile-side-heading .eyebrow{font-size:9px}
 .mobile-side-close{font-size:24px;width:40px;height:40px;color:var(--ink)}
 .mobile-side-content{overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;min-height:0;flex:1}
 .mobile-side-content>.rail,.mobile-side-content>.pages-rail{display:flex;position:static;float:none;grid-column:auto;grid-row:auto;width:100%;min-height:0;height:auto;overflow:visible;box-shadow:none;border:0;padding:16px 12px;background:transparent}
 .mobile-side-content>.rail{background:var(--sheet)}
 .mobile-side-content>.pages-rail{background:var(--bg)}
 .mobile-side-content .rail-foot{margin-top:17px}
 .mobile-side-content .page-stack{overflow:visible;max-height:none}
 .mobile-nav-extras{border-top:1px solid var(--line);margin:0 17px 15px;padding:18px 0}
 .mobile-extra-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin-top:11px}
 .mobile-extra-grid .btn{min-width:0;overflow-wrap:anywhere}
 .mobile-side-foot{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-shrink:0;border-top:1px solid var(--line);padding:10px 16px;background:var(--sheet)}
 .mobile-side-foot span{font-size:10px;color:var(--muted)}
 .mobile-side-foot button{color:var(--accent)}
}
@media(max-width:767px){.mobile-side-foot .tiny-btn{min-width:58px;padding:6px 8px;white-space:nowrap;flex-shrink:0}}

/* Alpha 0.6.2: iOS history-gesture collision mitigation. */
@media(max-width:767px){
  html,body{overscroll-behavior-x:none}
  .mobile-side-panel{overscroll-behavior-x:contain}
}


/* Alpha 0.7: writing-speed controls, comfortable on iPad with an external keyboard. */
.quick-actions{display:flex;gap:6px;flex-wrap:wrap;align-items:center;margin-top:7px}
.quick-actions .editor-inline-add{flex:0 1 auto;margin:0;white-space:nowrap}
.quick-actions .quick-same-speaker{color:var(--accent);border-color:var(--line)}
.quick-actions .quick-next-panel{color:var(--muted)}
.quick-actions button:disabled{opacity:.43;cursor:default}
.keyboard-hint{font-size:10px;color:var(--muted);line-height:1.7;margin:6px 0 0}
.quick-focus-setting{padding-top:13px;border-top:1px solid var(--line)}
.quick-toggle{display:flex!important;align-items:center;gap:9px;cursor:pointer;font-size:12px!important;line-height:1.6}
.quick-toggle input{width:17px;height:17px;accent-color:var(--accent);flex:none}
.quick-focus-setting small{display:block;font-size:10px;line-height:1.6;margin-top:4px}
@media(max-width:767px){
 .keyboard-hint{display:none}
 .quick-actions{gap:5px}
 .quick-actions .editor-inline-add{font-size:10px;padding:8px 6px;white-space:normal;line-height:1.4}
}


/* Alpha 0.8 — independently scrollable plot reference. */
.app-shell.plot-open{grid-template-columns:252px 196px minmax(0,1fr) var(--plot-width,320px)}
.app-shell.plot-open .workspace{grid-column:3;min-width:0}
.app-shell.plot-open .plot-pane{grid-column:4;grid-row:2}
.app-shell.plot-open.focus{grid-template-columns:minmax(0,1fr) var(--plot-width,320px)}
.app-shell.plot-open.focus .workspace{grid-column:1}
.app-shell.plot-open.focus .plot-pane{grid-column:2}
.app-shell.plot-open.plot-nav-visible .plot-nav-toggle,
.app-shell.plot-open .plot-trigger{color:var(--accent);background:var(--accent-wash);border-color:var(--line)}
.app-shell.plot-open:not(.plot-nav-visible):not(.focus).plot-compact{grid-template-columns:minmax(0,1fr) var(--plot-width,320px)}
.app-shell.plot-open:not(.plot-nav-visible):not(.focus).plot-compact .rail,
.app-shell.plot-open:not(.plot-nav-visible):not(.focus).plot-compact .pages-rail{display:none}
.app-shell.plot-open:not(.plot-nav-visible):not(.focus).plot-compact .workspace{grid-column:1}
.app-shell.plot-open:not(.plot-nav-visible):not(.focus).plot-compact .plot-pane{grid-column:2}
.plot-trigger{white-space:nowrap}
.plot-nav-toggle{display:none}
.plot-pane{background:var(--sheet);border-left:1px solid var(--line);display:flex;flex-direction:column;min-height:0;min-width:0;position:relative;overflow:hidden;color:var(--ink)}
.plot-resize-handle{position:absolute;left:0;top:0;bottom:0;width:9px;cursor:ew-resize;z-index:3;touch-action:none}
.plot-resize-handle:hover{background:color-mix(in srgb,var(--accent) 16%, transparent)}
.plot-pane-head{padding:19px 17px 12px 22px;display:flex;align-items:flex-start;justify-content:space-between;gap:8px;border-bottom:1px solid var(--line);flex-shrink:0}
.plot-pane-head h2{font-family:Georgia,'Yu Mincho',serif;font-size:21px;font-weight:500;margin:3px 0 7px}
.plot-pane-head small{display:block;font-size:11px;color:var(--muted);line-height:1.5;overflow-wrap:anywhere}
.plot-eyebrow{font-size:9px;letter-spacing:.16em;color:var(--accent);font-weight:700}
.plot-pane-controls{display:flex;gap:2px}
.plot-pane-toolbar{display:flex;gap:7px;padding:12px 17px 7px 22px;flex-shrink:0}
.plot-search-wrap{display:flex;align-items:center;gap:6px;margin:6px 17px 10px 22px;border:1px solid var(--line);border-radius:10px;padding:2px 7px;background:var(--bg);flex-shrink:0}
.plot-search-wrap label{color:var(--muted);font-size:18px}
.plot-search-wrap input{flex:1;min-width:0;border:0;background:transparent;padding:9px 4px;font-size:12px}
.plot-search-wrap .tiny-btn{font-size:16px}
.plot-scroll{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;padding:6px 18px 22px 22px;scrollbar-width:thin}
.plot-pane-foot{border-top:1px solid var(--line);flex-shrink:0;padding:12px 17px 12px 22px;display:flex;justify-content:space-between;gap:6px;color:var(--muted);font-size:10px}
.plot-document{font-family:var(--editor-family);font-size:clamp(12px, var(--editor-size), 17px);line-height:1.8}
.plot-paragraph{position:relative;padding:13px 10px;border-bottom:1px solid var(--line);border-radius:8px}
.plot-paragraph:hover,.plot-paragraph:focus-within{background:var(--bg)}
.plot-paragraph-text{white-space:pre-wrap;overflow-wrap:anywhere}
.plot-pin-btn{display:block;margin:8px 0 0 auto;font-size:10px;color:var(--muted);background:transparent;border:1px solid var(--line);border-radius:7px;padding:4px 8px}
.plot-pin-btn.is-pinned{background:var(--accent-wash);color:var(--accent)}
.plot-match{background:var(--accent-wash);color:var(--ink);border-bottom:2px solid var(--accent)}
.plot-empty{padding:24px 12px;color:var(--muted);line-height:1.8;font-size:12px}
.plot-empty strong{color:var(--ink);font-size:14px}
.plot-empty p{margin:8px 0 15px}
.plot-edit-label{display:block;font-size:12px;font-weight:700;margin:9px 0 12px}
.plot-editor-text{display:block;width:100%;min-height:320px;height:calc(100% - 80px);resize:vertical;border:1px solid var(--line);border-radius:11px;padding:15px 13px;font:inherit;font-family:var(--editor-family);font-size:clamp(13px,var(--editor-size),17px);line-height:1.8;background:var(--panel);color:var(--ink);white-space:pre-wrap}
.plot-editor-text:focus{border-color:var(--accent);outline:1px solid var(--accent)}
.plot-edit-note{font-size:11px;line-height:1.6;color:var(--muted)}
.plot-mini{display:none}
.plot-mobile-grip{display:none}
.plot-expand{display:none}
@media (min-width:1200px) and (max-width:1510px){
 .app-shell.plot-open{grid-template-columns:200px 150px minmax(0,1fr) var(--plot-width,320px)}
 .app-shell.plot-open .rail{padding:18px 10px}
 .app-shell.plot-open .pages-rail{padding:18px 8px}
 .app-shell.plot-open .workspace{padding:21px 24px 70px}
 .app-shell.plot-open .reading-lane{padding:20px 18px}
 .app-shell.plot-open .plot-nav-toggle{display:inline-flex}
}
@media (min-width:1200px){
 .app-shell.plot-open.plot-compact:not(.plot-nav-visible):not(.focus){grid-template-columns:minmax(0,1fr) var(--plot-width,320px)}
 .app-shell.plot-open.plot-compact:not(.plot-nav-visible):not(.focus) .rail,
 .app-shell.plot-open.plot-compact:not(.plot-nav-visible):not(.focus) .pages-rail{display:none}
 .app-shell.plot-open.plot-compact:not(.plot-nav-visible):not(.focus) .workspace{grid-column:1}
 .app-shell.plot-open.plot-compact:not(.plot-nav-visible):not(.focus) .plot-pane{grid-column:2}
}
@media (min-width:768px) and (max-width:1199px){
 .app-shell.plot-open .plot-nav-toggle{display:inline-flex}
 .app-shell.plot-open{grid-template-columns:185px minmax(0,1fr) var(--plot-width,300px)}
 .app-shell.plot-open .pages-rail{grid-column:1}
 .app-shell.plot-open .workspace{grid-column:2;padding:20px 17px 70px}
 .app-shell.plot-open .reading-lane{padding:20px 16px}
 .app-shell.plot-open .plot-pane{grid-column:3}
 .app-shell.plot-open:not(.plot-nav-visible):not(.focus){grid-template-columns:minmax(0,1fr) var(--plot-width,300px)}
 .app-shell.plot-open:not(.plot-nav-visible):not(.focus) .pages-rail{display:none}
 .app-shell.plot-open:not(.plot-nav-visible):not(.focus) .workspace{grid-column:1}
 .app-shell.plot-open:not(.plot-nav-visible):not(.focus) .plot-pane{grid-column:2}
 .app-shell.plot-open.focus{grid-template-columns:minmax(0,1fr) var(--plot-width,300px)}
 .app-shell.plot-open.focus .workspace{grid-column:1}
 .app-shell.plot-open.focus .plot-pane{grid-column:2}
 .app-shell.plot-open .plot-trigger{font-size:11px}
}
@media(max-width:767px){
 .app-shell.plot-open,.app-shell.plot-open.focus{grid-template-columns:minmax(0,1fr);grid-template-rows:61px minmax(0,1fr)}
 .app-shell.plot-open .workspace,.app-shell.plot-open.focus .workspace{grid-column:1}
 .app-shell.plot-open .plot-pane,.app-shell.plot-open.focus .plot-pane{grid-column:auto;grid-row:auto}
 .brand-word{display:none}
 .top-actions [data-action="focus"]{display:none}
 .top-actions .plot-trigger{min-height:32px;padding:6px 7px;gap:3px;font-size:11px}
 .plot-nav-toggle{display:none}
 .plot-pane{position:fixed!important;top:auto;bottom:0;left:0;right:0;height:61dvh;max-height:93dvh;width:100%;z-index:53;border-radius:22px 22px 0 0;border:1px solid var(--line);box-shadow:0 -14px 48px rgba(0,0,0,.15);padding-bottom:env(safe-area-inset-bottom);transition:height .16s}
 .app-shell.plot-expanded .plot-pane{height:93dvh}
 .plot-resize-handle{display:none}
 .plot-mobile-grip{height:22px;display:grid;place-items:center;touch-action:none;flex-shrink:0;cursor:ns-resize}
 .plot-mobile-grip span{height:5px;width:43px;border-radius:6px;background:var(--line)}
 .plot-expand{display:inline-grid}
 .plot-pane-head{padding:6px 16px 12px}
 .plot-pane-head h2{font-size:19px}
 .plot-scroll{padding:4px 15px 25px}
 .plot-pane-toolbar{padding:10px 15px 5px}
 .plot-search-wrap{margin:6px 15px 8px}
 .plot-document{font-size:14px}
 .plot-paragraph{padding:11px 6px}
 .plot-mini{display:block;position:fixed;left:10px;right:10px;bottom:calc(9px + env(safe-area-inset-bottom) + var(--plot-keyboard-offset,0px));z-index:45;border-radius:13px;border:1px solid var(--line);background:var(--sheet);box-shadow:0 4px 19px rgba(0,0,0,.14);padding:10px 12px 9px;max-height:123px;overflow:hidden}
 .plot-mini-top{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:11px;font-weight:650;color:var(--accent)}
 .plot-mini-top div{display:flex;align-items:center;gap:11px}
 .plot-mini-top button{border:0;background:transparent;color:var(--accent);font-size:10px;padding:3px 0}
 .plot-mini p{margin:6px 0 0;line-height:1.55;max-height:4.5em;overflow:hidden;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;font-size:12px;white-space:pre-wrap;overflow-wrap:anywhere}
 .plot-editor-text{min-height:230px}
}

/* Alpha 0.8.1: persistent phone editing history controls next to the scrollable page strip.
   Original desktop / iPad header history buttons are left untouched. */
.mobile-editor-toolbar{display:contents}
.mobile-history-controls{display:none}
@media (max-width:767px){
  .mobile-editor-toolbar{display:flex;align-items:center;gap:7px;min-width:0;margin-bottom:19px}
  .mobile-editor-toolbar .page-mobile-strip{display:flex;min-width:0;flex:1 1 auto;margin-bottom:0;gap:7px;overscroll-behavior-x:contain}
  .mobile-history-controls{display:flex;align-items:center;flex:0 0 auto;gap:5px;border-left:1px solid var(--line);padding-left:7px}
  .mobile-history-button{display:inline-grid!important;flex:0 0 auto;width:35px;height:35px;border:1px solid var(--line);background:var(--sheet);border-radius:10px;color:var(--ink);font-size:23px;line-height:1;touch-action:manipulation;-webkit-tap-highlight-color:transparent}
  .mobile-history-button:active{background:var(--accent-wash)}
}
@media (max-width:359px){
  .mobile-editor-toolbar{gap:5px}
  .mobile-history-controls{gap:4px;padding-left:5px}
  .mobile-history-button{width:33px;height:33px}
}


/* Alpha 0.9: a separate, calm writing surface for unformatted story documents. */
.mode-switch{display:grid;grid-template-columns:1fr 1fr;gap:4px;padding:4px;margin:0 2px 22px;border-radius:10px;background:var(--subtle);border:1px solid var(--line)}
.mode-switch button{min-width:0;border:0;border-radius:7px;padding:10px 3px;font-size:10px;font-weight:650;background:transparent;color:var(--muted);white-space:nowrap}
.mode-switch button.active{color:var(--ink);background:var(--sheet);box-shadow:0 1px 5px #0000000c}
.text-doc-list{display:flex;flex-direction:column;gap:5px}
.text-doc-line{display:flex;align-items:center;gap:1px;border:1px solid transparent;border-radius:10px;min-width:0}
.text-doc-line.current{background:var(--sheet);border-color:var(--line);box-shadow:var(--surface-shadow)}
.text-doc-line:hover{background:var(--sheet)}
.text-doc-item{display:flex;flex-direction:column;gap:5px;flex:1;min-width:0;border:0;background:transparent;padding:11px 6px 11px 12px;text-align:left;color:var(--ink)}
.text-doc-item strong{font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}
.text-doc-item small{font-size:10px;color:var(--muted)}
.text-doc-more{flex:none;width:26px}
.text-add{margin:16px 2px 0;min-height:38px;border-style:dashed}
.text-mode .workspace{padding:0;display:flex;flex-direction:column;scroll-behavior:auto;min-width:0}
.text-editor-shell{height:100%;width:100%;min-height:0;max-width:1120px;margin:0 auto;display:flex;flex-direction:column;overflow:hidden;padding:0 clamp(20px,4vw,66px)}
.text-editor-sticky{display:flex;align-items:center;justify-content:space-between;gap:14px;flex:none;padding:27px 0 18px;background:var(--bg);border-bottom:1px solid var(--line);position:relative;z-index:2}
.text-editor-meta{min-width:0}.text-editor-meta .section-kicker{margin-bottom:7px;font-size:10px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.text-editor-title{font-size:22px;font-weight:550;line-height:1.4;margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.text-editor-actions{display:flex;align-items:center;flex:none;gap:6px}
.text-character-count{font-size:13px;font-weight:700;color:var(--accent);white-space:nowrap;font-variant-numeric:tabular-nums;min-width:60px;text-align:right}
.text-writing-area{width:100%;min-height:0;height:100%;flex:1;resize:none;overflow-y:auto;border:0;outline:0!important;border-radius:0;background:var(--sheet);color:var(--ink);padding:30px clamp(18px,3.2vw,45px) 110px;margin:15px 0 0;font-family:var(--editor-family);font-size:var(--editor-size);line-height:var(--editor-line);white-space:pre-wrap;overflow-wrap:break-word;tab-size:4;-webkit-overflow-scrolling:touch;caret-color:var(--accent)}
.text-writing-area::placeholder{color:var(--muted)}
.text-history-mobile,.text-list-toggle{display:none!important}
.text-empty{max-width:720px;margin:auto;padding:35px;text-align:center}.text-empty h1{font-size:26px;font-weight:500}.text-empty p{color:var(--muted);font-size:13px;line-height:1.8}
.text-options-list{display:grid;gap:10px;margin:18px 0}.text-options-list .btn{justify-content:flex-start;min-height:43px}.text-options-list .btn.danger{color:#b35757}
.plot-source-row{display:flex;flex-direction:column;gap:5px;padding:8px 14px 12px;border-bottom:1px solid var(--line)}
.plot-source-row label{font-size:10px;color:var(--muted);font-weight:700}
.plot-source-row select{min-width:0;width:100%;background:var(--sheet);border:1px solid var(--line);border-radius:8px;padding:9px 7px;font-size:11px}
@media(min-width:768px) and (max-width:1199px) and (orientation:portrait){.text-mode .pages-rail{display:none}.text-mode .workspace{grid-column:1/-1}.text-mode .text-editor-shell{max-width:850px}.text-mode .text-list-toggle{display:inline-flex!important}}
@media(max-width:767px){
 .text-mode .workspace{padding:0!important}.text-editor-shell{padding:0 12px}.text-editor-sticky{padding:13px 1px 11px;gap:5px;align-items:flex-end}
 .text-editor-meta .section-kicker{font-size:9px;margin:0 0 3px}.text-editor-title{font-size:16px;max-width:145px}
 .text-editor-actions{gap:1px}.text-character-count{font-size:12px;min-width:55px}
 .text-history-mobile{display:inline-grid!important;width:29px;height:30px}.text-list-toggle{display:none!important}
 .text-editor-actions>.icon-btn:not(.text-history-mobile){width:27px;height:30px}
 .text-writing-area{padding:18px 12px 90px;margin:0;font-size:var(--editor-size)}
 .mobile-side-panel .text-documents-rail{display:flex!important;grid-column:auto!important;width:100%;border:0;background:transparent;padding:12px 3px}
}

.library-mode-mobile{display:none}
@media(max-width:767px){.mobile-side-content .library-mode-mobile{display:grid}}
@media(min-width:768px) and (max-width:1199px) and (orientation:portrait){
 .mobile-side-scrim{display:block;position:fixed;inset:0;z-index:72;background:rgba(20,23,28,.42)}
 .mobile-side-panel{position:absolute;top:0;bottom:0;right:0;width:min(390px,85vw);background:var(--bg);display:flex;flex-direction:column;box-shadow:0 12px 38px #0002;overflow:hidden}
 .mobile-side-heading{display:flex;align-items:center;justify-content:space-between;padding:22px 18px 14px;background:var(--sheet);border-bottom:1px solid var(--line)}
 .mobile-side-heading h2{font-size:19px;margin:3px 0}
 .mobile-side-content{overflow-y:auto;flex:1;min-height:0}
 .mobile-side-content>.pages-rail{display:flex!important;position:static;width:100%;padding:16px;background:transparent;border:0}
 .mobile-side-foot{display:flex;justify-content:flex-end;align-items:center;padding:10px 16px;border-top:1px solid var(--line)}
 .mobile-side-foot span{display:none}
}

/* nagi. Alpha 0.9.1 — user-supplied vector identity, light/dark themes. */
.nagi-header-logo{display:block;width:112px;height:auto;max-height:60px;object-fit:contain;flex:none;user-select:none;-webkit-user-drag:none}
.nagi-logo-night{display:none}
html[data-nagi-theme="night"] .nagi-logo-default{display:none}
html[data-nagi-theme="night"] .nagi-logo-night{display:block}
@media (max-width:1199px){.nagi-header-logo{width:105px}}
@media (max-width:767px){
 .main-top{gap:6px}
 .nagi-header-logo{width:86px;max-height:48px}
 .brand-group{flex:0 0 86px;min-width:0}
 .top-actions{gap:1px;min-width:0}
}
@media (max-width:390px){
 .nagi-header-logo{width:80px}
 .brand-group{flex-basis:80px}
}
@media (max-width:359px){
 .nagi-header-logo{width:68px}
 .brand-group{flex-basis:68px}
 .main-top{padding:0 7px;gap:3px}
}
@media (max-width:359px){.top-actions .btn.primary{padding:6px 3px;font-size:9px}}

/* Alpha 0.9.2: one-panel dialogue reorder, calm and fully theme-aware. */
.dialogue-heading{display:flex;align-items:center;justify-content:space-between;min-height:30px;gap:8px;margin:1px 0 8px}
.dialogue-heading .field-label{margin:0}
.dialogue-sort-toggle{background:transparent;border:1px solid var(--line);border-radius:8px;color:var(--accent);padding:5px 10px;font-size:11px;font-weight:600;min-height:29px;white-space:nowrap}
.dialogue-sort-toggle:hover,.dialogue-sort-toggle.is-active{background:var(--accent-wash)}
.dialogue-sort-mode{border:1px solid var(--line);background:var(--sheet);border-radius:11px;padding:10px;min-width:0}
.dialogue-sort-hint{color:var(--muted);font-size:11px;line-height:1.5;margin:0 0 10px}
.sort-phone-hint{display:none}
.dialogue-sort-list{display:flex;flex-direction:column;gap:8px}
.dialogue-sort-item{display:flex;align-items:center;gap:10px;padding:10px;background:var(--panel);border:1px solid var(--line);border-radius:10px;position:relative;min-width:0}
.dialogue-sort-item.sort-dragging{background:var(--accent-wash);border-color:var(--accent);opacity:.76}
.dialogue-sort-item.sort-drop-before:before,.dialogue-sort-item.sort-drop-after:after{content:'';position:absolute;left:0;right:0;height:3px;background:var(--accent);border-radius:2px;pointer-events:none}
.dialogue-sort-item.sort-drop-before:before{top:-6px}.dialogue-sort-item.sort-drop-after:after{bottom:-6px}
.dialogue-sort-handle{width:32px;height:40px;flex:0 0 32px;touch-action:none;border:0;background:transparent;color:var(--muted);font-size:24px;cursor:grab;border-radius:7px;user-select:none;-webkit-user-select:none}
.dialogue-sort-handle:hover,.dialogue-sort-handle:focus-visible{background:var(--subtle);color:var(--accent)}
.dialogue-is-dragging,.dialogue-is-dragging *{cursor:grabbing!important;user-select:none!important;-webkit-user-select:none!important}
.dialogue-sort-copy{flex:1;min-width:0}
.dialogue-sort-speaker{font-size:11px;font-weight:700;margin-bottom:5px;display:flex;align-items:center;gap:9px;overflow-wrap:anywhere}
.dialogue-sort-index{color:var(--muted);font-size:10px;min-width:13px}
.dialogue-sort-text{font-size:calc(var(--editor-size)*.79);line-height:1.65;white-space:pre-wrap;overflow-wrap:anywhere;color:var(--ink)}
.dialogue-sort-arrows{display:flex;flex-direction:column;gap:4px;flex:0 0 37px}
.dialogue-sort-arrows button{height:32px;min-width:37px;border:1px solid var(--line);border-radius:7px;background:var(--sheet);color:var(--ink);font-size:17px;touch-action:manipulation}
.dialogue-sort-arrows button:not(:disabled):hover{background:var(--accent-wash)}
.dialogue-sort-feedback{display:block;font-size:11px;color:var(--muted);min-height:0}
.dialogue-sort-feedback:empty{display:none}
@media(max-width:767px){
 .dialogue-sort-mode{padding:8px}
 .dialogue-sort-handle{display:none}
 .sort-desktop-hint{display:none}.sort-phone-hint{display:inline}
 .dialogue-sort-item{padding:10px 8px;gap:6px}
 .dialogue-sort-text{font-size:calc(var(--editor-size)*.73)}
 .dialogue-sort-arrows{flex-basis:42px}
 .dialogue-sort-arrows button{height:42px;min-width:42px;font-size:21px}
}
