/* Robse Doc */
:root {
  --bg: #ffffff;
  --fg: #1c1c1e;
  --muted: #6b6b70;
  --chrome: #f6f6f5;
  --chrome-2: #ececea;
  --border: #d9d9d6;
  --grid: #e3e3e0;
  --desk: #e9e9e6;
  --accent: #2459c4;
  --accent-soft: rgba(36, 89, 196, 0.09);
  --accent-head: #dfe7f7;
  /* 用紙（JS が上書きする） */
  --pw: 794px; --ph: 1123px; --mt: 132px; --mb: 113px; --ml: 113px; --mr: 113px; --gap: 24px;
  --ff: "Yu Mincho", YuMincho, "Hiragino Mincho ProN", serif;
  --fs: 10.5pt;
  --zoom: 1;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  grid-template-columns: minmax(0, 1fr); /* 狭い画面で用紙の幅に引っぱられて画面全体が広がらないように（報告画面などが画面外に出る） */
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font: 13px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo UI", Meiryo, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, select, input { font: inherit; color: inherit; }

/* ---------- 上部 ---------- */
#appbar {
  display: flex; align-items: center; gap: 10px;
  height: 42px; padding: 0 12px;
  background: #1c1c1e; color: #f5f5f5;
}
.brand { display: flex; align-items: center; gap: 7px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
#filename {
  min-width: 120px; width: 26ch; max-width: 40vw;
  background: transparent; border: 1px solid transparent; border-radius: 6px;
  color: #f5f5f5; padding: 3px 8px;
}
#filename:hover { border-color: #48484c; }
#filename:focus { outline: none; border-color: #8a8a90; background: #2a2a2e; }
#savestate { color: #a1a1a6; font-size: 12px; white-space: nowrap; }
.spacer { flex: 1; }
.pill {
  border: 1px solid #48484c; background: transparent; color: #f5f5f5;
  border-radius: 999px; padding: 3px 12px; cursor: pointer; white-space: nowrap;
}
.pill:hover { background: #2e2e32; }
.pill.primary { background: var(--accent); border-color: var(--accent); color: #fff; }

#toolbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 0;
  padding: 4px 8px; background: var(--chrome); border-bottom: 1px solid var(--border);
}
.grp { display: flex; align-items: center; gap: 2px; padding: 0 8px; border-right: 1px solid var(--border); }
.grp:last-child { border-right: 0; }
#toolbar button {
  display: inline-flex; align-items: center; justify-content: center;
  height: 28px; min-width: 28px; padding: 0 8px;
  border: 1px solid transparent; border-radius: 5px; background: transparent; cursor: pointer; white-space: nowrap;
}
#toolbar button.ic { padding: 0; width: 28px; }
#toolbar button.ic.split { width: auto; padding: 0 3px 0 5px; gap: 1px; }
#toolbar button:hover { background: var(--chrome-2); }
#toolbar button.on { background: var(--accent-head); border-color: #b7c7ea; }
#toolbar button:disabled { opacity: .35; cursor: default; background: transparent; }
#toolbar svg { width: 18px; height: 18px; }
#toolbar svg.caret { width: 9px; height: 9px; }
#toolbar select, #toolbar #fontsize {
  height: 28px; border: 1px solid var(--border); border-radius: 5px; background: #fff; padding: 0 6px;
}
#blockstyle { width: 7.5em; }
#fontfamily { width: 10em; }
#fontsize { width: 4.2em; }
.sw-a { position: relative; display: inline-flex; flex-direction: column; align-items: center; font-weight: 700; line-height: 1; padding-bottom: 4px; }
.sw-a .bar { position: absolute; left: -2px; right: -2px; bottom: 0; height: 3px; border-radius: 1px; }
#fcbar { background: #d11a2a; }
#hlbar { background: #ffe34d; }

/* 幅の狭いウインドウ・タブレットでは編集コマンドを選んだグループだけ表示する。 */
.tool-switches { display: none; }
#toolbar.compact-tools { position: relative; z-index: 35; gap: 2px 0; }
.compact-tools > .grp, .compact-tools .tool-switches { flex: 0 0 auto; }
.compact-tools .tool-switches { display: flex; gap: 2px; padding: 0 4px; }
#toolbar.compact-tools button, #toolbar.compact-tools select, #toolbar.compact-tools #fontsize {
  min-height: 36px;
}
#toolbar.compact-tools .tool-switches button { border-color: var(--border); }
#toolbar.compact-tools .tool-switches button[aria-expanded="true"] { border-color: #b7c7ea; }
.tool-panel {
  position: absolute; inset: calc(100% + 2px) 6px auto;
  max-height: min(42dvh, 340px); overflow: auto; overscroll-behavior: contain;
  padding: 6px; background: var(--chrome); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.tool-panel[hidden] { display: none; }
.tool-panel .grp { flex-wrap: wrap; padding: 2px; border: 0; }
@media (max-width: 560px) {
  #toolbar.compact-tools { padding-inline: 4px; }
  .compact-tools > .grp { padding-inline: 1px; gap: 0; }
  .compact-tools .tool-switches { padding-inline: 0; }
  #toolbar.compact-tools > .grp button:not(.ic) { padding-inline: 3px; }
  #toolbar.compact-tools > .grp button.ic { width: 28px; }
}
@media (max-width: 1180px) {
  #menu { max-width: calc(100vw - 12px); max-height: calc(100dvh - 16px); overflow: auto; }
  #menu button { white-space: normal; }
}

/* ---------- 用紙 ---------- */
#pages { overflow: auto; background: var(--desk); position: relative; overflow-anchor: none; }  /* ページ割りの測り直しで画面が飛ばないように */
#paper {
  position: relative; margin: 24px auto 40px;
  width: var(--pw); min-height: var(--ph);
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.18), 0 0 0 1px rgba(0,0,0,.04);
  zoom: var(--zoom);
}
#bands { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
#bands .band {
  position: absolute; left: -2px; right: -2px; height: var(--gap); background: var(--desk);
  box-shadow: inset 0 3px 3px -2px rgba(0,0,0,.18), inset 0 -3px 3px -2px rgba(0,0,0,.18);
}
#bands .hf img.hf-img, .print-paper .hf img.hf-img { display: inline-block; vertical-align: bottom; }
#bands .hf img.hf-fl, .print-paper .hf img.hf-fl { float: left; }
#bands .hf img.hf-fr, .print-paper .hf img.hf-fr { float: right; }
#bands .hf img.hf-fc, .print-paper .hf img.hf-fc { position: absolute; left: 50%; top: 0; transform: translateX(-50%); }
#bands .hf, .print-paper .hf { position: absolute; left: var(--ml); right: var(--mr); font-family: var(--ff); font-size: var(--fs); line-height: 1.5; color: #333; white-space: pre; overflow: hidden; }
#editor .ProseMirror {
  outline: none;
  padding: var(--mt) calc(var(--mr) + var(--sx0r, 0px)) var(--mb) calc(var(--ml) + var(--sx0l, 0px));  /* --sx0：幅の違う用紙があるとき、1 つ目の用紙を中央に置いた分 */
  font-family: var(--ff); font-size: var(--fs); line-height: var(--lr, 1.44);
  color: #111; word-break: normal; overflow-wrap: anywhere; line-break: strict;
  caret-color: #111;
  -webkit-font-smoothing: auto;
  tab-size: calc(var(--fs) * 4);  /* Word の既定のタブ位置：4字ごと */
}
.ProseMirror p, .ProseMirror h1, .ProseMirror h2, .ProseMirror h3 { margin: 0; line-height: calc(var(--lr, 1.44) * var(--lh, 1)); }  /* 1行の高さ＝書体ごとの倍率（Word で実測） */
.ProseMirror h1 { font-size: var(--h1-fs, 1.524em); font-weight: var(--h1-fw, 700); color: var(--h1-c, inherit); font-family: var(--h1-ff, inherit); padding: .4em 0 .2em; }  /* 16pt。スタイルの変更で変わる */
.ProseMirror h2 { font-size: var(--h2-fs, 1.143em); font-weight: var(--h2-fw, 700); color: var(--h2-c, inherit); font-family: var(--h2-ff, inherit); padding: .3em 0 .1em; }  /* 12pt */
.ProseMirror h3 { font-size: var(--h3-fs, 1em); font-weight: var(--h3-fw, 700); color: var(--h3-c, inherit); font-family: var(--h3-ff, inherit); padding: .2em 0 0; }
.ProseMirror ul, .ProseMirror ol { margin: 0; padding-left: 2em; }
.ProseMirror li > p { margin: 0; }
.ProseMirror blockquote { margin: 0; padding: 0 0 0 1.2em; border-left: 3px solid #c8c8c4; color: #444; }
.ProseMirror hr { border: 0; border-top: 1px solid #555; margin: .6em 0; }
.ProseMirror a { color: #1f4fb4; text-decoration: underline; }
.ProseMirror mark { color: inherit; padding: 0; }
.ProseMirror img { max-width: 100%; height: auto; display: block; }
.ProseMirror [data-resize-container], .ProseMirror [data-resize-wrapper] { max-width: 100%; }
.ProseMirror [data-align="center"] > img, .ProseMirror img[data-align="center"] { margin: 0 auto; }
.ProseMirror img[data-align="right"] { margin-left: auto; }
.ProseMirror [data-resize-container]:has(img[data-align="center"]) { margin-left: auto; margin-right: auto; }
.ProseMirror [data-resize-container]:has(img[data-align="right"]) { margin-left: auto; }
.ProseMirror img.ProseMirror-selectednode, .ProseMirror .ProseMirror-selectednode img { outline: 2px solid var(--accent); }
.ProseMirror .page-break {
  height: 0; border-top: 1px dashed #9aa6c2; margin: 6px 0; position: relative; cursor: default;
}
.ProseMirror .page-break::after {
  content: "改ページ"; position: absolute; left: 50%; top: -8px; transform: translateX(-50%);
  background: #fff; color: #7280a0; font: 10px/14px -apple-system, "Hiragino Sans", "Yu Gothic UI", sans-serif; padding: 0 6px;
}
.ProseMirror .page-break.ProseMirror-selectednode { border-top-color: var(--accent); }
.ProseMirror .pb-spacer { display: block; pointer-events: none; user-select: none; }
/* 縦書き：文字は上から下、行は右から左、ページも右から左へ並ぶ */
body.vertical #paper { writing-mode: vertical-rl; margin: 24px 24px 40px; }
body.vertical #bands .band { top: -2px; bottom: -2px; right: auto; width: var(--gap); height: auto; box-shadow: inset 3px 0 3px -2px rgba(0,0,0,.18), inset -3px 0 3px -2px rgba(0,0,0,.18); }
body.vertical .hf, body.vertical #bands .hf { writing-mode: horizontal-tb; right: auto; }
body.vertical .fn-sep { width: auto; height: 33%; border-top: 0; border-right: 1px solid #555; margin: 0 7px 0 6px; }
body.vertical .ProseMirror ul, body.vertical .ProseMirror ol { padding-left: 0; padding-top: 2em; }
.ProseMirror { text-orientation: mixed; }
.ProseMirror.pb-measuring .pb-split, .ProseMirror.pb-measuring .pb-spacer { display: none !important; }
.ProseMirror.pb-measuring td.pb-row, .ProseMirror.pb-measuring th.pb-row { padding-block-start: 2px !important; }
.ProseMirror.pb-measuring .pb-row::before { display: none !important; }
.ProseMirror.pb-measuring tr.cell-flow-row { height: var(--original-row-height, auto) !important; }
.ProseMirror .pb-split { display: inline-block; inline-size: 100%; vertical-align: top; pointer-events: none; user-select: none; text-indent: 0; }
.ProseMirror td.pb-row, .ProseMirror th.pb-row { padding-block-start: calc(var(--pb) + 2px); }
/* 押し下げた行：前のページ側の余白は枠線を消し、次のページの頭に上の線を引く */
.ProseMirror table[data-borders="none"] td.pb-row::before { border-bottom-color: transparent; }
.ProseMirror td.pb-row::before, .ProseMirror th.pb-row::before {
  content: ""; position: absolute; inset-inline-start: -1px; inset-inline-end: -1px; inset-block-start: 1px; block-size: calc(var(--pb) - 1px);
  background: #fff; border-block-end: var(--tb-ih, 1px solid #444); box-sizing: border-box; pointer-events: none;
}
/* 表 */
.ProseMirror table { border-collapse: collapse; table-layout: fixed; width: 100%; margin: 0; overflow: hidden; }
.ProseMirror td, .ProseMirror th {
  border-top: var(--tb-ih, 1px solid #444); border-bottom: var(--tb-ih, 1px solid #444);
  border-left: var(--tb-iv, 1px solid #444); border-right: var(--tb-iv, 1px solid #444);
  padding: 2px 6px; vertical-align: top; position: relative; min-width: 1em; box-sizing: border-box;  /* Word のセルの余白（上下 1.5pt・左右 4.5pt）と同じ */
}
/* 表の端のセル（外枠） */
.ProseMirror td.tb-et, .ProseMirror th.tb-et { border-top: var(--tb-top, 1px solid #444); }
.ProseMirror td.tb-eb, .ProseMirror th.tb-eb { border-bottom: var(--tb-bottom, 1px solid #444); }
.ProseMirror td.tb-el, .ProseMirror th.tb-el { border-left: var(--tb-left, 1px solid #444); }
.ProseMirror td.tb-er, .ProseMirror th.tb-er { border-right: var(--tb-right, 1px solid #444); }
.ProseMirror [data-bb] { border-bottom: 1px solid #333; }
/* 段落の罫線（Word と同じく、文字の位置は変えずに外側へ引く。左右は 4pt 外、上下は 1pt あける） */
.ProseMirror [data-bx] { position: relative; padding-top: 3px; padding-bottom: 3px; }
.ProseMirror [data-bx]::after {
  content: ""; position: absolute; pointer-events: none;
  inset-block: 0; inset-inline-start: calc(var(--ind, 0px) - 4pt); inset-inline-end: -4pt;
  border-top: var(--bx-top, 0 none); border-bottom: var(--bx-bottom, 0 none); border-left: var(--bx-left, 0 none); border-right: var(--bx-right, 0 none);
}
.ProseMirror [data-bx].bx-jp { padding-top: 0; }
.ProseMirror [data-bx].bx-jp::after { border-top: 0; }
.ProseMirror [data-bx].bx-jn { padding-bottom: 0; }
.ProseMirror [data-bx].bx-jn::after { border-bottom: 0; }
/* 均等割り付け（段落・選んだ文字） */
.ProseMirror [data-dist] { text-justify: inter-character; }
.ProseMirror .fit { display: inline-block; text-align: justify; text-align-last: justify; text-justify: inter-character; text-indent: 0; letter-spacing: 0; white-space: nowrap; vertical-align: baseline; }
/* 行グリッド（文字数と行数の指定）：行の高さは段落ごとに付ける。中の文字は行の高さを広げない */
/* 行数を指定したときの見出しの前後：Word に保存する見出しの設定（前 6/4/2pt・後 3/1/0pt）と同じ */
.ProseMirror.rd-grid h1 { padding: 6pt 0 3pt; } .ProseMirror.rd-grid h2 { padding: 4pt 0 1pt; } .ProseMirror.rd-grid h3 { padding: 2pt 0 0; }
.ProseMirror .gl :is(span, strong, em, u, s, sub, sup, mark, a, ins, del, ruby):not(.tab-fill):not(.pb-split):not(.fit):not(.enc):not(.csc),
.ProseMirror .gl .fit :is(span, strong, em, u, s, sub, sup, mark, a, ins, del) { line-height: 0; }
.ProseMirror .gl .fit, .ProseMirror .gl .csc { line-height: 1.2; }
.ProseMirror.rd-grid { letter-spacing: var(--ls, 0); }
.ProseMirror [data-shade] { background-clip: content-box; }  /* 網かけは前後の間隔にかけない（Word と同じ） */
.ProseMirror th { background: #f2f2f0; font-weight: 700; text-align: left; }
.ProseMirror .tableWrapper { overflow-x: auto; margin: 2px 0; }
/* 印刷・PDFでは、列幅をピクセルに丸めて生じる数pxのはみ出しで表の外枠を切らない。 */
.print-paper .tableWrapper { overflow: visible; }
.ProseMirror .selectedCell::after { content: ""; position: absolute; inset: 0; background: var(--accent-soft); pointer-events: none; }
.ProseMirror .column-resize-handle { position: absolute; right: -2px; top: 0; bottom: -2px; width: 4px; background: var(--accent); pointer-events: none; }
.ProseMirror.resize-cursor { cursor: col-resize; }
/* 回り込み・テキストボックス */
.ProseMirror [data-resize-container]:has(img[data-wrap="left"]) { float: left; margin: 2px 1em .3em 0; }
.ProseMirror [data-resize-container]:has(img[data-wrap="right"]) { float: right; margin: 2px 0 .3em 1em; }
.ProseMirror img[data-wrap="left"] { float: left; margin: 2px 1em .3em 0; }
.ProseMirror img[data-wrap="right"] { float: right; margin: 2px 0 .3em 1em; }
.ProseMirror .textbox { border: 1px solid #444; padding: 6px 10px; margin: 2px 0 .4em; box-sizing: border-box; }
.ProseMirror .textbox[data-border="none"] { border: 1px dashed #c9d2e3; }
.ProseMirror .textbox[data-wrap="left"] { float: left; margin-right: 1em; }
.ProseMirror .textbox[data-wrap="right"] { float: right; margin-left: 1em; }
.ProseMirror .textbox[data-wrap="none"] { width: auto; }
.ProseMirror .page-break, .ProseMirror h1, .ProseMirror h2 { clear: both; }
/* 段組み */
.ProseMirror .cols { column-gap: 2em; column-fill: balance; outline: 1px dashed #d6dbe6; outline-offset: 3px; margin: 2px 0; }
.ProseMirror .cols[data-rule] { column-rule: 1px solid #999; }
.ProseMirror .cols > h1, .ProseMirror .cols > h2, .ProseMirror .cols > h3 { break-after: avoid-column; }
/* 1ページに収まらない段組み（横書き）：1 段の幅の列に並べ、ページ割りが段ごと・ページごとの場所へ移す */
.ProseMirror .cols.cols-flow { column-count: 1 !important; columns: auto !important; column-rule: none; inline-size: calc((var(--secw, 100%) - (var(--n, 2) - 1) * 2em) / var(--n, 2)); position: relative; outline: none; }
.ProseMirror .cols-flow .cl-tail { position: relative; }
.ProseMirror .cl-rules { position: absolute; inset: 0; pointer-events: none; user-select: none; }
.ProseMirror .cl-rules i { position: absolute; width: 0; border-left: 1px solid #999; }
.ProseMirror.pb-measuring .cl-mv { transform: none !important; }
.ProseMirror.pb-measuring .cl-tail { position: static !important; }
.ProseMirror.pb-measuring .cols-flow { block-size: auto !important; }
.ProseMirror.pb-measuring .cl-rules { display: none; }
/* 表の見出しの行の写し（表が次のページへ続いたとき、そのページの頭に重ねて出す。触れない） */
.ProseMirror .rep-heads { position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: 1; pointer-events: none; user-select: none; }
.ProseMirror .rep-heads .rep-head { position: absolute; margin: 0 !important; transform: none !important; translate: none !important; }
.ProseMirror.pb-measuring .rep-heads { display: none; }
.ProseMirror .cols.cols-long { column-count: auto !important; columns: auto !important; column-rule: none; outline-color: #e8b04b; }
.ProseMirror .cols.cols-long > * { break-inside: auto; }
.ProseMirror .cols.cols-long::before { content: "段組み（縦書きで1ページを超えるため画面では1段で表示。Word 保存では段組み）"; display: block; font: 10px/1.6 -apple-system, "Hiragino Sans", "Yu Gothic UI", sans-serif; color: #b07a12; }
/* タブ位置 */
.ProseMirror .tab-fill { display: inline-block; white-space: pre; overflow: hidden; vertical-align: baseline; color: transparent; }
.ProseMirror .tab-dot { background: radial-gradient(circle, #333 0 1px, transparent 1.3px) repeat-x left 85% / .35em .35em; }
.ProseMirror .tab-dash { background: linear-gradient(to right, #333 55%, transparent 55%) repeat-x left 80% / .5em 1px; }
.ProseMirror .tab-line { background: linear-gradient(#333, #333) no-repeat left 88% / 100% 1px; }
/* 変更履歴 */
.ProseMirror .rev-ins { color: #0b6e4f; text-decoration: underline; text-decoration-color: #0b6e4f; background: rgba(11, 110, 79, .06); }
.ProseMirror .rev-del { color: #b42318; text-decoration: line-through; text-decoration-color: #b42318; }
#st-track { color: #b42318; font-weight: 600; }
/* コメント */
.ProseMirror .cmt { background: #fff1b8; border-bottom: 2px solid #f0c24b; }
#pages.has-cmt { padding-right: 280px; }
#cmtcol { position: absolute; top: 0; width: 240px; }
.cmt-card { position: absolute; left: 0; width: 240px; background: #fff; border: 1px solid #e5d7a4; border-left: 4px solid #f0c24b; border-radius: 6px; padding: 7px 10px; font-size: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.08); cursor: pointer; }
.cmt-card.on { border-color: #d9a72a; box-shadow: 0 2px 10px rgba(0,0,0,.15); }
.cmt-card .who { color: var(--muted); font-size: 11px; margin-bottom: 2px; }
.cmt-card .txt { white-space: pre-wrap; line-height: 1.5; }
.cmt-card .act { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.cmt-card .act button { border: 0; background: none; color: var(--accent); cursor: pointer; font-size: 11px; padding: 0; }
.cmt-card .act button[data-a="del"] { color: #b42318; }
@media (max-width: 1100px) { #pages.has-cmt { padding-right: 0; } #cmtcol { display: none; } }
/* 脚注 */
.ProseMirror { counter-reset: fn; }
.ProseMirror .fn-ref { font-size: .7em; line-height: 0; vertical-align: super; color: #1f4fb4; cursor: pointer; padding: 0 1px; }
.ProseMirror .fn-ref::after { counter-increment: fn; content: counter(fn); }
.ProseMirror .fn-ref.ProseMirror-selectednode { outline: 1px solid var(--accent); }
.fn-area, .fn-measure { position: absolute; left: var(--ml); right: var(--mr); font-family: var(--ff); color: #222; }
.fn-measure { visibility: hidden; top: 0; left: -9999px; right: auto; }
.fn-sep { width: 33%; border-top: 1px solid #555; margin: 6px 0 7px; }
.fn-item { font-size: calc(var(--fs) * .857); line-height: 1.5; }
.fn-item sup { font-size: .75em; }
/* ルビ */
.ProseMirror ruby { ruby-align: center; }
.ProseMirror ruby rt { font-size: .5em; user-select: none; }
.ProseMirror ruby.ProseMirror-selectednode { background: var(--accent-soft); outline: 1px solid var(--accent); }
/* 目次 */
.ProseMirror .toc { margin: 4px 0 8px; cursor: default; }
.ProseMirror .toc.ProseMirror-selectednode { outline: 2px solid var(--accent); outline-offset: 2px; }
.ProseMirror .toc-title { font-weight: 700; font-size: 1.143em; text-align: center; padding-bottom: .3em; }
.ProseMirror .toc-row { display: flex; align-items: baseline; gap: 4px; cursor: pointer; }
.ProseMirror .toc-row:hover .t { color: var(--accent); text-decoration: underline; }
.ProseMirror .toc-row .dots { flex: 1; border-bottom: 1px dotted #888; transform: translateY(-.3em); min-width: 1em; }
.ProseMirror .toc-row.lvl2 { padding-left: 1em; }
.ProseMirror .toc-row.lvl3 { padding-left: 2em; }
.ProseMirror .toc-empty { color: #999; text-align: center; font-size: .9em; }
/* 検索 */
.find-hit { background: #ffe58a; }
.find-cur { background: #ff9d2e; }
/* 何も書いていないとき */
.ProseMirror p.is-editor-empty:first-child::before {
  content: attr(data-placeholder); color: #a8a8ad; pointer-events: none; float: left; height: 0;
}

/* ---------- 下部 ---------- */
#status {
  display: flex; align-items: center; gap: 16px; height: 28px; padding: 0 12px;
  background: var(--chrome); border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; white-space: nowrap;
}
#zoom { width: 110px; accent-color: var(--accent); }
.zbtn { border: 0; background: transparent; cursor: pointer; font-size: 14px; width: 20px; color: var(--muted); }
#zoomval { width: auto; min-width: 3.2em; text-align: right; font-size: 12px; padding: 0 2px; }

/* ---------- 検索バー ---------- */
#findbar {
  position: fixed; top: 92px; right: 18px; z-index: 40; width: 380px; max-width: calc(100vw - 24px);
  background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 8px;
}
#findbar[hidden] { display: none; }
.frow { display: flex; align-items: center; gap: 4px; padding: 3px 0; }
.frow input:not([type]) , .frow input[type=""] { flex: 1; }
#findq, #replq { flex: 1; min-width: 0; height: 28px; border: 1px solid var(--border); border-radius: 5px; padding: 0 8px; }
.fbtn { height: 28px; min-width: 28px; border: 1px solid var(--border); background: #fff; border-radius: 5px; cursor: pointer; }
.fbtn:hover { background: var(--chrome-2); }
.fbtn.wide { padding: 0 10px; }
.frow label { display: inline-flex; align-items: center; gap: 4px; margin-right: 10px; }
#findcount { min-width: 5em; text-align: right; }

/* ---------- メニュー ---------- */
#menu {
  position: fixed; z-index: 50; min-width: 180px; padding: 4px;
  background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.18);
}
#menu[hidden] { display: none; }
#menu button {
  display: flex; justify-content: space-between; gap: 18px; width: 100%;
  padding: 6px 10px; border: 0; border-radius: 5px; background: transparent; text-align: left; cursor: pointer; white-space: nowrap;
}
#menu button:hover { background: var(--accent-head); }
#menu button:disabled { opacity: .4; background: transparent; cursor: default; }
#menu button.on::before { content: "✓"; position: absolute; margin-left: -2px; }
#menu .k { color: var(--muted); font-size: 12px; }
#menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 2px; }
#menu .palette { display: grid; grid-template-columns: repeat(8, 22px); gap: 4px; padding: 6px; }
#menu .palette button { width: 22px; height: 22px; padding: 0; border-radius: 4px; border: 1px solid rgba(0,0,0,.15); }
#menu .palette button:hover { outline: 2px solid var(--accent); }
#menu .tgrid { display: grid; grid-template-columns: repeat(10, 16px); gap: 2px; padding: 6px; }
#menu .tgrid button { width: 16px; height: 16px; padding: 0; border: 1px solid #c9c9c5; border-radius: 0; background: #fff; }
#menu .tgrid button.on { background: var(--accent-head); border-color: var(--accent); }
#menu .tlabel { text-align: center; color: var(--muted); font-size: 12px; padding: 2px 0 4px; }

#toast {
  position: fixed; left: 50%; bottom: 48px; transform: translate(-50%, 20px); z-index: 60;
  background: #1c1c1e; color: #fff; padding: 8px 16px; border-radius: 8px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: #b42318; }

/* ---------- ダイアログ ---------- */
dialog {
  border: 0; border-radius: 12px; padding: 0; width: min(640px, calc(100vw - 32px));
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}
dialog::backdrop { background: rgba(0, 0, 0, .35); }
dialog form { padding: 22px 26px; max-height: calc(100vh - 80px); overflow: auto; }
dialog h2 { margin: 0 0 6px; font-size: 18px; }
dialog h3 { margin: 18px 0 6px; font-size: 14px; }
dialog .lead { margin: 0; color: var(--muted); }
.keys { border-collapse: collapse; width: 100%; }
.keys td { padding: 5px 8px; border-bottom: 1px solid var(--grid); vertical-align: top; }
.keys td:first-child { color: var(--muted); width: 42%; }
.small { font-size: 12px; }
.muted { color: var(--muted); }
.dlgbtns { display: flex; gap: 8px; flex-direction: row-reverse; justify-content: flex-start; margin-top: 16px; }
dialog .pill { border-color: var(--border); color: var(--fg); }
dialog .pill:hover { background: var(--chrome-2); }
dialog .pill.primary { color: #fff; border-color: var(--accent); background: var(--accent); }
dialog .pill.primary:hover { background: #1c4aa6; }
dialog .pill.danger { color: #b42318; border-color: #f0c2bd; margin-right: auto; }
.prow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding: 9px 0; border-bottom: 1px solid var(--grid); }
.plabel { width: 7.5em; color: var(--muted); flex: none; }
.prow label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.prow select { height: 28px; border: 1px solid var(--border); border-radius: 5px; background: #fff; padding: 0 6px; }
.prow input.num { width: 4.6em; height: 26px; border: 1px solid var(--border); border-radius: 5px; padding: 0 6px; }
.prow textarea.txt { flex: 1; min-width: 200px; border: 1px solid var(--border); border-radius: 5px; padding: 6px 8px; font: inherit; resize: vertical; }
.prow input.txt { flex: 1; min-width: 200px; height: 28px; border: 1px solid var(--border); border-radius: 5px; padding: 0 8px; }
#doclist { max-height: 320px; overflow: auto; border: 1px solid var(--grid); border-radius: 8px; }
#doclist .doc { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--grid); }
#doclist .doc:last-child { border-bottom: 0; }
#doclist .doc .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; font-weight: 600; }
#doclist .doc .nm:hover { color: var(--accent); }
#doclist .doc .dt { color: var(--muted); font-size: 12px; }
#doclist .doc .del { border: 0; background: transparent; color: #b42318; cursor: pointer; font-size: 12px; }
#doclist .doc.cur .nm::after { content: "（編集中）"; color: var(--muted); font-weight: 400; }
#doclist .empty { padding: 14px; color: var(--muted); }

/* ---------- 利用規約への同意 ---------- */
dialog#consentdlg { width: min(560px, calc(100vw - 32px)); }
dialog#consentdlg::backdrop { background: rgba(28, 28, 30, .55); }
.consent-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.consent-brand strong { display: block; font-size: 18px; }
.consent-brand span { color: var(--muted); font-size: 12px; }
.consent-list { margin: 6px 0 12px; padding-left: 1.2em; line-height: 1.7; }
.consent-list li { margin: 4px 0; }
.consent-terms { margin: 8px 0; }
.consent-terms a { color: var(--accent); font-weight: 600; }
.consent-check { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--chrome); cursor: pointer; }
.consent-check input { width: 18px; height: 18px; }
#consentok:disabled { opacity: .45; cursor: default; }

@media (max-width: 720px) {
  .brand span, #savestate, #st-paper { display: none; }
  #filename { width: 16ch; }
  #zoom { width: 80px; }
  .grp { padding: 0 4px; flex-wrap: wrap; }
  #paper { margin: 12px auto; }
}

/* ---------- 印刷 ---------- */
#printarea { display: none; }
@media print {
  html, body { height: auto !important; overflow: visible !important; }
  body { display: block !important; background: #fff; }
  body > *:not(#printarea) { display: none !important; }
  #printarea { display: block !important; }
  /* 画面と同じページ割り：用紙の高さちょうどで区切れるように並べる */
  .print-paper { position: relative; width: var(--pw); overflow: hidden; background: #fff; }
  .print-page { position: relative; overflow: hidden; break-after: page; background: #fff; }
  .print-page:last-child { break-after: auto; }
  .print-clip { display: inline-block; vertical-align: top; position: relative; overflow: hidden; }
  .print-clip > .print-paper { overflow: visible; }
  html.print-vertical { writing-mode: vertical-rl; }
  html.print-vertical .print-paper { writing-mode: vertical-rl; width: auto; }
  html.print-vertical .hf { writing-mode: horizontal-tb; }
  .print-paper .ProseMirror { padding: var(--mt) calc(var(--mr) + var(--sx0r, 0px)) var(--mb) calc(var(--ml) + var(--sx0l, 0px)); font-family: var(--ff); font-size: var(--fs); line-height: var(--lr, 1.44); color: #000; }
  .print-paper .hf, .print-paper .fn-area { position: absolute; }
  .print-paper .fn-ref { color: #000 !important; }
  .print-paper .cols { outline: none !important; }
  .print-paper .rev-ins { background: none !important; }
  .print-paper .cols-long::before { display: none !important; }
  .print-paper .cmt { background: none !important; border: 0 !important; }
  .print-paper .fn-measure { display: none; }
  .print-paper .pb-brk { display: block !important; width: auto !important; break-before: page; }
  .print-paper .pb-brk-row { break-before: page; }
  .print-paper .pb-brk-row > td::before, .print-paper .pb-brk-row > th::before { inset-block-start: -2px !important; block-size: calc(var(--pb) + 1px) !important; }
  .print-paper .ProseMirror > :first-child { margin-top: 0; }
  .print-paper .page-break { border: 0 !important; }
  .print-paper .page-break::after { display: none; }
  .print-paper.rd-page-images .page-break { border-top: 1px solid transparent !important; }
  .print-paper table[data-borders="none"] td, .print-paper table[data-borders="none"] th { border-color: transparent !important; }
  .print-paper .textbox[data-border="none"] { border-color: transparent !important; }
  .print-paper { --guide: transparent; }
  .print-paper img { outline: none !important; }
  .print-paper .toc-row .t { color: inherit !important; text-decoration: none !important; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* 0.3.0 保持できない内容・自動保存できないとき */
#savestate.err { color: #b42318; font-weight: 600; }
.warnpill { background: #fff4e5; border-color: #f0b46a; color: #8a4b00; }
.losslist { margin: 8px 0 12px; padding-left: 20px; max-height: 40vh; overflow: auto; }
.losslist li { margin: 3px 0; }
#lossdlg { max-width: 640px; }

/* 0.4.0 罫線の画面・ヘッダーの画像 */
.bsw { display: inline-block; width: 26px; height: 0; vertical-align: middle; margin-right: 2px; }
.bsw[data-k="single"] { border-top: 1px solid #333; }
.bsw[data-k="thick"] { border-top: 2px solid #333; }
.bsw[data-k="double"] { border-top: 3px double #333; }
.bsw[data-k="dotted"] { border-top: 1px dotted #333; }
.bsw[data-k="dashed"] { border-top: 1px dashed #333; }
.bsec .pill { padding: 3px 10px; }
.hfthumb { max-height: 32px; max-width: 120px; border: 1px solid var(--grid); }
#gridhint { min-height: 1em; }
.prow [hidden] { display: none !important; }

/* 0.5.0 透かし・文字の書式・書式のコピー */
.wm { position: absolute; display: flex; align-items: center; justify-content: center; overflow: hidden; pointer-events: none; mix-blend-mode: multiply; }
.wm span { white-space: nowrap; font-family: var(--ff); font-weight: 700; opacity: .55; line-height: 1; }
.ProseMirror .tcy { text-combine-upright: all; -webkit-text-combine: horizontal; }
.ProseMirror .bouten { -webkit-text-emphasis: filled dot; text-emphasis: filled dot; -webkit-text-emphasis-position: over right; text-emphasis-position: over right; }
.ProseMirror .bouten[data-bouten="comma"] { -webkit-text-emphasis-style: filled sesame; text-emphasis-style: filled sesame; }
.ProseMirror .bouten[data-bouten="circle"] { -webkit-text-emphasis-style: open circle; text-emphasis-style: open circle; }
.ProseMirror .bouten[data-bouten="underDot"] { -webkit-text-emphasis-position: under left; text-emphasis-position: under left; }
.ProseMirror .enc { display: inline-flex; align-items: center; justify-content: center; inline-size: 1.45em; block-size: 1.45em; border: .1em solid currentColor; border-radius: 50%; font-size: .72em; line-height: 1; vertical-align: .05em; text-indent: 0; }
.ProseMirror .enc { font-feature-settings: "palt"; letter-spacing: 0; }
.ProseMirror .enc-square { border-radius: 0; }
.ProseMirror .enc.ProseMirror-selectednode { outline: 1px solid var(--accent); }
body.fmtcopy .ProseMirror { cursor: copy; }

/* 0.5.0 見出しの一覧・画像の枠線・文末脚注・トリミング */
#navpane { position: fixed; z-index: 30; left: 0; top: 84px; bottom: 28px; width: 220px; background: #fff; border-right: 1px solid var(--border); overflow: auto; font-size: 12px; }
#navpane[hidden] { display: none; }
body.nav-open #pages { padding-left: 220px; }
.navhead { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; font-weight: 700; border-bottom: 1px solid var(--grid); position: sticky; top: 0; background: #fff; }
.navhead button { border: 0; background: none; cursor: pointer; font-size: 14px; color: var(--muted); }
#navlist .nv { display: flex; gap: 6px; padding: 5px 10px; cursor: pointer; line-height: 1.4; }
#navlist .nv:hover { background: var(--accent-head); }
#navlist .nv.l2 { padding-left: 22px; } #navlist .nv.l3 { padding-left: 34px; }
#navlist .nv .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#navlist .nv .p { color: var(--muted); }
#navlist .empty { padding: 10px; color: var(--muted); }
.ProseMirror img[data-border="thin"] { box-shadow: 0 0 0 1px #333; }
.ProseMirror img[data-border="thick"] { box-shadow: 0 0 0 2.5px #333; }
.ProseMirror { counter-reset: fn en; }
.ProseMirror .en-ref::after { counter-increment: en; content: counter(en, lower-roman); }
.ProseMirror > .en-area { margin-top: 1.5em; font-family: var(--ff); color: #222; user-select: none; }
.ProseMirror.pb-measuring > .en-area { margin-block-start: 0 !important; }
.cropwrap { margin-top: 10px; max-height: 50vh; overflow: auto; text-align: center; }
#cropcv { max-width: 100%; border: 1px solid var(--grid); }
@media (max-width: 720px) { body.nav-open #pages { padding-left: 0; } #navpane { width: 70vw; box-shadow: 0 4px 20px rgba(0,0,0,.2); } }
.prow[hidden] { display: none !important; }

/* 0.5.0 セクション区切り・図形・図表番号・相互参照 */
.ProseMirror .sect-break { height: 0; border-top: 2px double #9aa6c2; margin: 10px 0; position: relative; cursor: default; clear: both; }
.ProseMirror .sect-break::after { content: attr(data-label); position: absolute; left: 0; right: 0; top: -9px; margin: 0 auto; width: max-content; max-width: 100%; background: #fff; color: #5d6b8c; font: 10px/16px -apple-system, "Hiragino Sans", "Yu Gothic UI", sans-serif; padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ProseMirror .sect-break.ProseMirror-selectednode { border-top-color: var(--accent); }
.print-paper .sect-break { border: 0 !important; margin: 0 !important; }
.print-paper .sect-break::after { display: none; }
/* Keep the measured anchor offsets when the page is cloned for PDF or printing.
   The direct PDF always adds rd-page-images so break lines and margins keep the on-screen geometry (0.15.3). */
.print-paper.rd-page-images .sect-break { border-top: 2px double transparent !important; margin: 10px 0 !important; }
.ProseMirror .shape-node { position: relative; margin: 4px 0; max-width: 100%; }
.ProseMirror .shape-node[data-align="center"] { margin-left: auto; margin-right: auto; }
.ProseMirror .shape-node[data-align="right"] { margin-left: auto; }
.ProseMirror .shape-node[data-wrap="left"] { float: left; margin: 2px 1em .3em 0; }
.ProseMirror .shape-node[data-wrap="right"] { float: right; margin: 2px 0 .3em 1em; }
.ProseMirror .shape-node .shape-svg { position: absolute; inset: 0; overflow: visible; }
/* 文字の前面・背面に置いた図形（0.15.6）：場所を取らず、ドラッグで自由に動かす */
.ProseMirror .shape-node:is([data-wrap="front"], [data-wrap="behind"]) { float: none; max-width: none; }
.ProseMirror .shape-node[data-wrap="front"] { z-index: 3; }
.ProseMirror .shape-node[data-wrap="behind"] { z-index: -1; }
#editor .ProseMirror[contenteditable="true"] .shape-node:is([data-wrap="front"], [data-wrap="behind"]) { cursor: move; touch-action: none; }
.ProseMirror .shape-node .shape-text { position: absolute; inset: 6px 8px; display: flex; align-items: center; justify-content: center; text-align: center; white-space: pre-wrap; line-height: 1.4; overflow: hidden; }

.ProseMirror .shape-node.ProseMirror-selectednode { outline: 2px solid var(--accent); outline-offset: 2px; }
/* 図形の大きさを変えるつまみ（右下の四角）。選んだときだけ出す */
.ProseMirror[contenteditable="true"] .shape-node.ProseMirror-selectednode::after { content: ''; position: absolute; right: -7px; bottom: -7px; width: 10px; height: 10px; background: #fff; border: 2px solid var(--accent); border-radius: 2px; box-sizing: border-box; pointer-events: none; z-index: 2; }
body:has(.shape-node.grip-hover) #editor, body:has(.shape-node.grip-hover) #editor *, .ProseMirror .shape-node.resizing { cursor: nwse-resize !important; }
@media print { .print-paper .shape-node::after { display: none !important; } }
.ProseMirror .seq::after { content: attr(data-n); }
.ProseMirror .xref::after { content: attr(data-label); }
.ProseMirror .xref { color: #1f4fb4; }
.print-paper .xref { color: inherit; }
.ProseMirror .seq.ProseMirror-selectednode, .ProseMirror .xref.ProseMirror-selectednode { outline: 1px solid var(--accent); }

.pill[hidden], button[hidden] { display: none !important; }

/* 0.6.0 差し込み印刷 */
.ProseMirror .mf { background: #e8effc; color: #1f4fb4; border-radius: 3px; padding: 0 1px; }
.ProseMirror .mf.mf-on { background: #fff4c2; color: inherit; }
.ProseMirror .mf.mf-on .mf-n { display: none; }
.ProseMirror .mf.mf-on::after { content: attr(data-val); }
.ProseMirror .mf.ProseMirror-selectednode { outline: 1px solid var(--accent); }
.print-paper .mf { background: none !important; color: inherit !important; }
#st-merge { color: #8a4b00; font-weight: 600; }

/* 0.6.0 文章のチェック */
#chkpane { position: fixed; z-index: 30; right: 0; top: 84px; bottom: 28px; width: 300px; background: #fff; border-left: 1px solid var(--border); overflow: auto; font-size: 12.5px; }
#chkpane[hidden] { display: none; }
body.chk-open #pages { padding-right: 300px; }
#chklist .ck-group { padding: 8px 12px 4px; font-weight: 700; color: var(--fg); border-top: 1px solid var(--grid); }
#chklist .ck-group small { display: block; font-weight: 400; color: var(--muted); }
#chklist .ck { padding: 5px 12px 5px 18px; cursor: pointer; line-height: 1.5; }
#chklist .ck:hover { background: var(--accent-head); }
#chklist .ck mark { background: #ffe08a; padding: 0 1px; }
#chklist .ck-ok { padding: 14px 12px; color: #1f7a45; }
#chklist .ck-sum { padding: 8px 12px; color: var(--muted); }
@media (max-width: 720px) { body.chk-open #pages { padding-right: 0; } #chkpane { width: 80vw; box-shadow: 0 4px 20px rgba(0,0,0,.2); } }

/* 0.6.0 ページ罫線・行番号 */
.pgbd { position: absolute; pointer-events: none; box-sizing: border-box; }
.lnno { position: absolute; width: 28px; text-align: right; font: 9pt/1 var(--ff); color: #666; pointer-events: none; }

/* 0.7.0 ひな形・文字数・版の履歴 */
.tpllist { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin: 10px 0; }
.tpllist button { text-align: left; border: 1px solid var(--border); border-radius: 10px; background: #fff; padding: 10px 12px; cursor: pointer; font: inherit; }
.tpllist button:hover { border-color: var(--accent); background: var(--accent-soft); }
.tpllist b { display: block; margin-bottom: 4px; }
.tpllist span { font-size: 12px; color: var(--muted); line-height: 1.5; display: block; }
.stbtn { border: 0; background: none; color: inherit; font: inherit; cursor: pointer; padding: 0; }
.stbtn:hover { text-decoration: underline; }
.histlist { max-height: 50vh; overflow: auto; border: 1px solid var(--grid); border-radius: 8px; }
.histlist .h { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--grid); }
.histlist .h:last-child { border-bottom: 0; }
.histlist .h .t { flex: 1; }
.histlist .h .m { color: var(--muted); font-size: 12px; }
.histlist .h button { border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 3px 12px; cursor: pointer; font: inherit; font-size: 12px; }
.histlist .empty { padding: 14px; color: var(--muted); }

/* 0.7.0 入力欄・表の斜線 */
.ProseMirror .ff { cursor: pointer; border-radius: 3px; }
.ProseMirror .ff-text, .ProseMirror .ff-select { background: #eef3fc; border-bottom: 1px solid #9fb5e6; padding: 0 3px; }
.ProseMirror .ff-empty { color: #7d8db0; }
.ProseMirror .ff-check { font-size: 1.1em; }
.ProseMirror .ff.ProseMirror-selectednode { outline: 1px solid var(--accent); }
.print-paper .ff-text, .print-paper .ff-select { background: none !important; }
.print-paper .ff-empty { color: transparent !important; }
.ProseMirror td[data-diag="down"], .ProseMirror th[data-diag="down"] { background-image: linear-gradient(to top right, transparent calc(50% - .7px), #333 50%, transparent calc(50% + .7px)); }
.ProseMirror td[data-diag="up"], .ProseMirror th[data-diag="up"] { background-image: linear-gradient(to bottom right, transparent calc(50% - .7px), #333 50%, transparent calc(50% + .7px)); }
.genko svg { display: block; position: absolute; inset: 0; }
/* 割注：小さな文字を2行に */
.ProseMirror .wari, .print-paper .wari { display: inline-flex; align-items: stretch; vertical-align: middle; line-height: 1; white-space: nowrap; }
.wari .wari-b { font-size: 1em; display: inline-flex; align-items: center; transform: scaleY(1.15); }
.wari .wari-in { display: inline-flex; flex-direction: column; justify-content: center; font-size: .5em; line-height: 1.05; }
body.vertical .wari .wari-in { flex-direction: row-reverse; }
/* 隠し文字：ふだんは見せない。「隠し文字を表示」のときは点線の下線で見せる。印刷はしない */
.ProseMirror .hid { display: none; }
body.show-hidden .ProseMirror .hid { display: inline; text-decoration: underline dotted #6a7bd0; text-underline-offset: 3px; }
.print-paper .hid { display: none !important; }
/* 文字の網かけ・囲み線・拡大/縮小（0.10.0） */
.ProseMirror .cshd { background: #d9d9d9; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.ProseMirror .cbdr { box-shadow: 0 0 0 .75px currentColor; }
.ProseMirror .csc { display: inline-block; white-space: nowrap; transform: scaleX(var(--csc, 1)); transform-origin: 0 50%; text-indent: 0; }
body.vertical .ProseMirror .csc { transform: scaleX(var(--csc, 1)); transform-origin: 50% 0; }
body.vertical .ProseMirror .csc-in { margin: 0 !important; }
/* 編集記号（段落の終わり ↵・全角の空白 □・半角の空白 ·・タブ →）。幅を持たせない（ページ割りを変えない） */
.ProseMirror .pmark { display: inline-block; inline-size: 0; position: relative; user-select: none; pointer-events: none; }
.ProseMirror .pmark::after { content: '↵'; position: absolute; inset-inline-start: 1px; color: #3b7dd8; font-size: 10pt; line-height: 1; top: 50%; transform: translateY(-50%); }
body.vertical .ProseMirror .pmark::after { top: 0; left: 50%; transform: translateX(-50%); }
.ProseMirror .ws-z, .ProseMirror .ws-h { position: relative; }
.ProseMirror .ws-z::after { content: ''; position: absolute; inset: 18% 12%; border: 1px solid #8fb1e0; pointer-events: none; }
.ProseMirror .ws-h::after { content: ''; position: absolute; left: 50%; top: 50%; width: 2px; height: 2px; margin: -1px 0 0 -1px; border-radius: 50%; background: #3b7dd8; pointer-events: none; }
body.show-marks .ProseMirror .tab-fill { position: relative; }
body.show-marks .ProseMirror .tab-fill::after { content: '→'; position: absolute; left: 1px; top: 50%; transform: translateY(-50%); color: #3b7dd8; font-size: 9pt; line-height: 1; }
.print-paper .pmark, .svpaper .pmark { display: none !important; }
.print-paper .ws-z::after, .print-paper .ws-h::after, .print-paper .tab-fill::after { content: none !important; }
/* ドロップキャップ：最初の字を行数分の大きさにして左へ */
.ProseMirror p[data-dropcap]::first-letter, .print-paper p[data-dropcap]::first-letter { float: left; font-size: calc(var(--dcl) * 1lh * .86); line-height: 1; margin: .04em .1em 0 0; }
body.vertical .ProseMirror p[data-dropcap]::first-letter, body.vertical .print-paper p[data-dropcap]::first-letter { float: right; margin: 0 0 .12em .05em; }
/* 描画キャンバス */
.ProseMirror .dcanvas { position: relative; margin: 4px 0; cursor: pointer; outline: 1px dashed transparent; }
.ProseMirror .dcanvas img { display: block; width: 100%; height: 100%; }
.ProseMirror .dcanvas:hover, .ProseMirror .dcanvas.ProseMirror-selectednode { outline-color: #8aa0d8; }
.print-paper .dcanvas { outline: none !important; }
.print-paper .dcanvas img { display: block; width: 100%; height: 100%; }
#cvdlg { max-width: min(96vw, 900px); }
.cvbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.cvsep { width: 1px; height: 22px; background: var(--line, #ddd); margin: 0 4px; }
.cvwrap { max-height: 58vh; max-width: 100%; overflow: auto; background: #eceae4; padding: 12px; }
#cvstage { position: relative; background: #fff; box-shadow: 0 0 0 1px #c9c6bd; touch-action: none; user-select: none; margin: 0 auto; }
#cvstage > svg { display: block; }
#cvstage .cvsel { position: absolute; outline: 1.5px solid #3b6bd6; pointer-events: none; }
#cvstage .cvh { position: absolute; width: 10px; height: 10px; background: #fff; border: 1.5px solid #3b6bd6; transform: translate(-50%, -50%); cursor: nwse-resize; }
/* 索引・参考文献・引用 */
.index-block, .biblio-block { margin: 8px 0; padding: 4px 0; }
.index-block .ix-head { font-weight: bold; margin: 8px 0 2px; border-bottom: 1px solid #ccc; }
.biblio-block .bib-row { display: flex; gap: .4em; }
.biblio-block .bib-row .bn { flex: none; }
.ProseMirror .xe { display: none; }
body.show-hidden .ProseMirror .xe { display: inline; }
body.show-hidden .ProseMirror .xe::after { content: "｛索引：" attr(data-xe) "｝"; font-size: .7em; color: #6a7bd0; }
.ProseMirror .cite { white-space: nowrap; }
.srclist { list-style: none; padding: 0; margin: 0 0 10px; max-height: 30vh; overflow: auto; }
.srclist li { display: flex; gap: 6px; align-items: center; padding: 4px 0; border-bottom: 1px solid var(--line, #e5e3dc); }
.srclist li span { flex: 1; font-size: 13px; }
/* 番号の書式（Word と同じ並び。何も指定しない番号は 1. → a) → i. の順） */
@counter-style rd-paren { system: extends decimal; prefix: "("; suffix: ") "; }
@counter-style rd-circle { system: fixed; symbols: "①" "②" "③" "④" "⑤" "⑥" "⑦" "⑧" "⑨" "⑩" "⑪" "⑫" "⑬" "⑭" "⑮" "⑯" "⑰" "⑱" "⑲" "⑳"; suffix: " "; fallback: rd-paren; }
@counter-style rd-jouko { system: extends cjk-decimal; prefix: "第"; suffix: "条　"; }
@counter-style rd-jouko-d { system: extends decimal; prefix: "第"; suffix: "条　"; }
@counter-style rd-kanji { system: extends cjk-decimal; suffix: "、"; }
@counter-style rd-full { system: numeric; symbols: "０" "１" "２" "３" "４" "５" "６" "７" "８" "９"; suffix: "．"; }
@counter-style rd-kana { system: extends katakana; suffix: ". "; }
@counter-style rd-iroha { system: extends katakana-iroha; suffix: ". "; }
@counter-style rd-upper { system: extends upper-alpha; suffix: ". "; }
@counter-style rd-lower { system: extends lower-alpha; suffix: ") "; }
@counter-style rd-roman { system: extends lower-roman; suffix: ". "; }
.ProseMirror ol ol, .print-paper ol ol { list-style-type: rd-lower; }
.ProseMirror ol ol ol, .print-paper ol ol ol { list-style-type: lower-roman; }
.ProseMirror ol[data-fmt="decimal"], .print-paper ol[data-fmt="decimal"] { list-style-type: decimal; }
.ProseMirror ol[data-fmt="paren"], .print-paper ol[data-fmt="paren"] { list-style-type: rd-paren; }
.ProseMirror ol[data-fmt="circle"], .print-paper ol[data-fmt="circle"] { list-style-type: rd-circle; }
.ProseMirror ol[data-fmt="jouko"], .print-paper ol[data-fmt="jouko"] { list-style-type: rd-jouko-d; padding-left: 4.2em; }
.ProseMirror ol[data-fmt="kanji"], .print-paper ol[data-fmt="kanji"] { list-style-type: rd-kanji; }
.ProseMirror ol[data-fmt="fullwidth"], .print-paper ol[data-fmt="fullwidth"] { list-style-type: rd-full; padding-left: 2.6em; }
.ProseMirror ol[data-fmt="kana"], .print-paper ol[data-fmt="kana"] { list-style-type: rd-kana; }
.ProseMirror ol[data-fmt="iroha"], .print-paper ol[data-fmt="iroha"] { list-style-type: rd-iroha; }
.ProseMirror ol[data-fmt="upper"], .print-paper ol[data-fmt="upper"] { list-style-type: rd-upper; }
.ProseMirror ol[data-fmt="lower"], .print-paper ol[data-fmt="lower"] { list-style-type: rd-lower; }
.ProseMirror ol[data-fmt="roman"], .print-paper ol[data-fmt="roman"] { list-style-type: rd-roman; }
.ProseMirror ul[data-mark] > li, .print-paper ul[data-mark] > li { list-style-type: var(--mk); }
#toolbar button.ic.dd { width: 14px; font-size: 10px; margin-left: -3px; }
/* 記号と特殊文字 */
#symdlg { max-width: min(96vw, 640px); }
#symlist { max-height: 60vh; overflow: auto; }
.symhead { font-size: 12px; color: #666; margin: 8px 0 4px; }
.symgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 3px; }
.symgrid button { height: 34px; font-size: 18px; border: 1px solid var(--line, #ddd); background: #fff; border-radius: 4px; cursor: pointer; font-family: var(--ff); }
.symgrid button:hover { background: #eef2fb; border-color: #8aa0d8; }
/* ルーラー */
#ruler { position: sticky; top: 0; left: 0; z-index: 6; height: 22px; background: #f3f2ee; border-bottom: 1px solid #d8d6cf; user-select: none; touch-action: none; }
#rulerin { position: relative; height: 100%; }
#ruler .rl-body { position: absolute; top: 3px; height: 16px; background-color: #fff; background-image: linear-gradient(to right, #c9c6bd 1px, transparent 1px); box-shadow: 0 0 0 1px #d8d6cf; cursor: copy; }
#ruler .rl-num { position: absolute; top: 1px; transform: translateX(-50%); font-size: 9px; color: #777; pointer-events: none; }
#ruler .rm { position: absolute; width: 0; height: 0; transform: translateX(-5px); cursor: ew-resize; z-index: 2; }
#ruler .rm-first { top: 1px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 8px solid #3b6bd6; }
#ruler .rm-left { bottom: 1px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 8px solid #3b6bd6; }
#ruler .rm-tab { bottom: 3px; width: 8px; height: 8px; transform: translateX(-1px); border-left: 2px solid #222; border-bottom: 2px solid #222; }
#ruler .rm-tab-right { transform: translateX(-7px); border-left: 0; border-right: 2px solid #222; }
#ruler .rm-tab-center { transform: translateX(-4px); border-left: 0; border-bottom: 2px solid #222; width: 8px; }
#ruler .rm-tab-center::after { content: ""; position: absolute; left: 3px; bottom: 0; height: 8px; border-left: 2px solid #222; }
@media print { #ruler { display: none !important; } }
#menu .tconv { display: block; width: 100%; margin-top: 4px; padding: 6px 8px; border: 0; border-top: 1px solid var(--line, #e5e3dc); background: none; font: inherit; font-size: 12px; text-align: left; cursor: pointer; } #menu .tconv:hover { background: #eef2fb; }
/* コメントの返信・解決済み */
.cmt-card .reps .rep { margin-top: 5px; padding: 4px 0 0 8px; border-top: 1px dashed #eadfb8; }
.cmt-card .reps .rep b { display: block; font-weight: normal; color: #8a7a4a; font-size: 11px; }
.cmt-card.done { opacity: .55; border-left-color: #9a9a9a; }
.cmt-card.done .txt, .cmt-card.done .reps { display: none; }
.cmt-card.done:hover { opacity: 1; }
.cmt-card.done:hover .txt, .cmt-card.done:hover .reps { display: block; }
.ProseMirror .cmt[data-cdone] { background: none; border-bottom: 1px dotted #c8c8c8; }
/* 文字の効果 */
.tfx[data-fx="shadow"] { text-shadow: .06em .06em .08em rgba(0,0,0,.45); }
.tfx[data-fx="outline"] { -webkit-text-fill-color: #fff; -webkit-text-stroke: .045em currentColor; paint-order: stroke fill; }
.tfx[data-fx="emboss"] { -webkit-text-fill-color: #e9e9e9; text-shadow: -.04em -.04em 0 #fff, .05em .05em .02em #777; }
.tfx[data-fx="imprint"] { -webkit-text-fill-color: #e9e9e9; text-shadow: .04em .04em 0 #fff, -.05em -.05em .02em #777; }
/* 文字の前面・背面の画像（段落の左上から --x, --y の位置） */
.ProseMirror { isolation: isolate; }
.ProseMirror [data-resize-container]:has(img[data-wrap="front"]), .ProseMirror [data-resize-container]:has(img[data-wrap="behind"]) { position: relative; height: 0 !important; overflow: visible; margin: 0 !important; }
.ProseMirror img[data-wrap="front"], .ProseMirror img[data-wrap="behind"], .print-paper img[data-wrap="front"], .print-paper img[data-wrap="behind"] { position: absolute; left: var(--x, 0px); top: var(--y, 0px); cursor: move; max-width: none; }
.ProseMirror img[data-wrap="front"], .print-paper img[data-wrap="front"] { z-index: 3; }
.ProseMirror img[data-wrap="behind"], .print-paper img[data-wrap="behind"] { z-index: -1; }
/* Move the wrapper so the image and its resize handle share the same bounds. */
:is(.ProseMirror, .print-paper) [data-resize-wrapper]:has(> img:is([data-wrap="front"], [data-wrap="behind"])) {
  position: absolute !important;
  left: calc(var(--x, 0px) + var(--anchor-x, 0px)); top: calc(var(--y, 0px) + var(--anchor-y, 0px));
  width: max-content; max-width: none; pointer-events: none;
}
:is(.ProseMirror, .print-paper) [data-resize-wrapper] > img:is([data-wrap="front"], [data-wrap="behind"]) {
  position: relative; left: auto; top: auto; margin: 0; pointer-events: auto;
}
.ProseMirror [data-node="image"] [data-resize-wrapper] > img:is([data-wrap="left"], [data-wrap="right"]) { float: none; margin: 0; }
.ProseMirror [data-node="image"]:has(> [data-resize-wrapper] > img[data-align="center"]:not([data-wrap])) { justify-content: center; }
.ProseMirror [data-node="image"]:has(> [data-resize-wrapper] > img[data-align="right"]:not([data-wrap])) { justify-content: end; }
#editor .ProseMirror [data-node="image"] [data-resize-handle] { display: none; }
#editor .ProseMirror[contenteditable="true"] [data-node="image"].ProseMirror-selectednode [data-resize-wrapper] > [data-resize-handle="bottom-right"],
#editor .ProseMirror[contenteditable="true"] [data-node="image"].ProseMirror-selectednode [data-resize-wrapper]:has(> img:is([data-wrap="right"], [data-align="right"]:not([data-wrap]))) > [data-resize-handle="bottom-left"] {
  display: block; width: 12px; height: 12px; transform: translate(50%, 50%); z-index: 4;
  pointer-events: auto; touch-action: none; cursor: nwse-resize;
  background: white; border: 2px solid var(--accent); border-radius: 2px;
}
#editor .ProseMirror[contenteditable="true"] [data-node="image"].ProseMirror-selectednode [data-resize-wrapper]:has(> img:is([data-wrap="right"], [data-align="right"]:not([data-wrap]))) > [data-resize-handle="bottom-right"] { display: none; }
#editor .ProseMirror[contenteditable="true"] [data-node="image"].ProseMirror-selectednode [data-resize-wrapper] > [data-resize-handle="bottom-left"] { transform: translate(-50%, 50%); cursor: nesw-resize; }
#editor .ProseMirror[contenteditable="true"] [data-node="image"] img:is([data-wrap="front"], [data-wrap="behind"]) { touch-action: none; }
#editor .ProseMirror[contenteditable="false"] img:is([data-wrap="front"], [data-wrap="behind"]) { cursor: default; }
/* 見出し 4〜6（Word の既定と同じく本文と同じ大きさ。スタイルの変更で変わる） */
.ProseMirror h4, .ProseMirror h5, .ProseMirror h6 { margin: 0; line-height: calc(var(--lr, 1.44) * var(--lh, 1)); padding: .15em 0 0; }
.ProseMirror h4 { font-size: var(--h4-fs, 1em); font-weight: var(--h4-fw, 700); color: var(--h4-c, inherit); font-family: var(--h4-ff, inherit); }
.ProseMirror h5 { font-size: var(--h5-fs, 1em); font-weight: var(--h5-fw, 700); color: var(--h5-c, inherit); font-family: var(--h5-ff, inherit); }
.ProseMirror h6 { font-size: var(--h6-fs, 1em); font-weight: var(--h6-fw, 700); color: var(--h6-c, inherit); font-family: var(--h6-ff, inherit); }
/* 脚注の番号の形 */
@counter-style rd-chicago { system: symbolic; symbols: "*" "†" "‡" "§"; }
body[data-fnfmt="circle"] .ProseMirror .fn-ref::after { content: counter(fn, rd-circle); }
body[data-fnfmt="roman"] .ProseMirror .fn-ref::after { content: counter(fn, lower-roman); }
body[data-fnfmt="chicago"] .ProseMirror .fn-ref::after { content: counter(fn, rd-chicago); }
/* 図表目次 */
.tof-block { margin: 8px 0; }
/* ページの色 */
#paper, .print-paper { background: var(--pagebg, #fff); }
@media print { .print-paper { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
/* 見出し一覧の章の移動 */
#navlist .nv .nvmv { border: 0; background: none; color: #888; cursor: pointer; padding: 0 3px; font-size: 12px; visibility: hidden; }
#navlist .nv:hover .nvmv { visibility: visible; }
#navlist .nv .nvmv:hover { color: var(--accent, #3b6bd6); }
/* 閲覧モード */
body.read-mode #toolbar, body.read-mode #appbar, body.read-mode #ruler, body.read-mode #findbar { display: none !important; }
body.read-mode .nvmv, body.read-mode .cmt-card .act { display: none; }
body.read-mode #pages { background: #ddd9cf; }
#readbar { position: fixed; top: 8px; right: 12px; z-index: 50; }
#readbar button { border: 1px solid #c9c6bd; background: #fff; border-radius: 16px; padding: 6px 14px; font: inherit; font-size: 13px; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
/* 画面の分割 */
body.split #pages { margin-bottom: 38vh; }
#splitview { position: fixed; left: 0; right: 0; bottom: 26px; height: 38vh; background: var(--desk, #e9e7e1); border-top: 2px solid #b9b5aa; z-index: 20; display: flex; flex-direction: column; }
#splitview .svhead { font-size: 12px; color: #555; padding: 3px 10px; background: #f3f2ee; display: flex; justify-content: space-between; align-items: center; }
#splitview .svhead button { border: 1px solid #ccc; background: #fff; border-radius: 4px; font: inherit; cursor: pointer; }
#svbody { flex: 1; overflow: auto; }
#svbody .svpaper { position: relative; margin: 24px auto 40px; width: var(--pw); min-height: var(--ph); background: var(--pagebg, #fff); zoom: var(--zoom); box-shadow: 0 1px 3px rgba(0,0,0,.18); }
/* hidden を付けた部品は、上の display の指定より優先して隠す（分割の画面が最初から出ていた） */
/* 新しい版に切り替わったときの帯（上の中央） */
#updbar { position: fixed; top: 8px; left: 50%; transform: translateX(-50%); z-index: 70; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; max-width: calc(100vw - 32px); background: #1c1c1e; color: #fff; font-size: 13px; padding: 8px 10px 8px 16px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,.25); }
#updbar button { border: 0; border-radius: 6px; padding: 5px 12px; font: inherit; cursor: pointer; background: #fff; color: #1c1c1e; }
#updbar #updlater { background: transparent; color: #ddd; text-decoration: underline; padding: 5px 6px; }
#updbar span { white-space: nowrap; }
@media (max-width: 760px) { #updbar { top: auto; bottom: 34px; } #updbar span { white-space: normal; } }
#splitview[hidden], #readbar[hidden], #ruler[hidden], #updbar[hidden] { display: none !important; }

/* 0.9.0 数式・グラフ */
.ProseMirror .mathnode, .print-paper .mathnode { display: inline-block; vertical-align: baseline; cursor: pointer; padding: 0 1px; border-radius: 3px; text-indent: 0; }
/* 独立した行の数式：行いっぱいの幅で中央に（block にすると前後に空の行ができる） */
.ProseMirror .mathnode.disp, .print-paper .mathnode.disp { width: 100%; box-sizing: border-box; text-align: center; padding: 2px 0; }
.ProseMirror .mathnode:hover { background: rgba(31, 79, 180, .07); }
.ProseMirror .mathnode.ProseMirror-selectednode { outline: 1px solid #8aa0d8; }
math { font-family: 'Cambria Math', 'STIX Two Math', 'Latin Modern Math', math; font-size: 1.05em; }
.mathnode math[display="block"] { display: inline math; }
.print-paper .mathnode { background: none !important; outline: none !important; }
.ProseMirror .chartnode, .print-paper .chartnode { position: relative; margin: 4px 0; display: block; }
.ProseMirror .chartnode { cursor: pointer; outline: 1px dashed transparent; }
.ProseMirror .chartnode img, .print-paper .chartnode img { display: block; width: 100%; height: 100%; }
.ProseMirror .chartnode:hover, .ProseMirror .chartnode.ProseMirror-selectednode { outline-color: #8aa0d8; }
.print-paper .chartnode { outline: none !important; }
#mathdlg { width: min(860px, 96vw); }
.mathpal { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 0 10px; max-height: 230px; overflow: auto; padding: 6px; border: 1px solid var(--border); border-radius: 8px; background: var(--chrome-2, #f6f7f9); }
.mpgrp { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; }
.mph { width: 100%; font-size: 11px; color: var(--muted); margin-top: 2px; }
.mpb { min-width: 30px; height: 30px; padding: 0 6px; border: 1px solid var(--border); border-radius: 6px; background: #fff; color: #111; cursor: pointer; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; }
.mpb:hover { border-color: var(--accent); background: #eef3fd; }
.mpb math { font-size: 13px; }
#mathsrc { width: 100%; box-sizing: border-box; font: 14px/1.5 ui-monospace, Menlo, Consolas, monospace; padding: 8px; border: 1px solid var(--border); border-radius: 6px; margin-top: 4px; }
.mathprev { min-height: 64px; margin: 10px 0; padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: #fff; color: #000; font-size: 20px; display: flex; align-items: center; justify-content: center; overflow: auto; }
#chartdlg { width: min(1000px, 97vw); }
.chartgrid { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.chartleft { flex: 1 1 420px; min-width: 0; }
.chartprev { flex: 0 1 430px; display: flex; justify-content: center; padding: 6px; background: var(--chrome-2, #f6f7f9); border-radius: 8px; }
.chtablewrap { max-height: 240px; overflow: auto; border: 1px solid var(--border); border-radius: 6px; }
#chtable { border-collapse: collapse; }
#chtable td { border: 1px solid var(--border); padding: 0; }
#chtable input { width: 84px; border: 0; padding: 4px 6px; font: inherit; font-size: 13px; background: transparent; }
#chtable tr:first-child input, #chtable td:first-child input { font-weight: 600; background: #f3f5f9; }
#chtable input:focus { outline: 2px solid var(--accent); outline-offset: -2px; background: #fff; }

/* 0.11.0 ブックマーク（本文では幅を取らない。編集記号を出したときだけ印を見せる）・ブックマークの一覧・文書のプロパティ */
.ProseMirror .bm { display: inline; }
body.show-marks .ProseMirror .bm { position: relative; }
body.show-marks .ProseMirror .bm::after { content: ''; position: absolute; left: -1px; top: -.1em; width: 2px; height: 1.1em; background: #8a8f99; pointer-events: none; }
.ProseMirror .bm.ProseMirror-selectednode::after { content: ''; position: absolute; left: -1px; top: -.1em; width: 2px; height: 1.1em; background: #3b7dd8; }
.ProseMirror .bm.ProseMirror-selectednode { position: relative; }
.bmlist { max-height: 240px; overflow: auto; margin: 6px 0; border: 1px solid var(--grid); border-radius: 6px; }
.bmlist:empty::before { content: 'まだブックマークはありません'; display: block; padding: 10px; color: var(--muted); font-size: 13px; }
.bmlist .bmrow { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--grid); }
.bmlist .bmrow:last-child { border-bottom: 0; }
.bmlist .bmrow .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bmlist .bmrow button { font-size: 12px; padding: 2px 8px; }
#linkplace { flex: 1; min-width: 0; }

/* セクション区切りで用紙の大きさ・余白が変わるとき：そのセクションの段落などを、その用紙の本文の位置と幅に置く（--sl・--sr は 1 つ目の用紙の本文の端からのずれ） */
.ProseMirror > .sec-x { margin-left: var(--sl); margin-right: var(--sr); }
.ProseMirror > .sec-x[data-resize-container]:has(img[data-align="center"]) { margin-left: auto; margin-right: auto; translate: var(--sc) 0; }
.ProseMirror > .sec-x[data-resize-container]:has(img[data-align="right"]) { margin-left: auto; margin-right: var(--sr); }
.ProseMirror > .sec-x[data-resize-container]:has(img[data-wrap="left"]) { margin-left: var(--sl); }
.ProseMirror > .sec-x[data-resize-container]:has(img[data-wrap="right"]) { margin-right: var(--sr); }
#bands .band.side { box-shadow: inset 3px 0 3px -2px rgba(0,0,0,.18), inset -3px 0 3px -2px rgba(0,0,0,.18); }

@media (max-width: 380px) {
  #status { gap: 4px; padding-inline: 6px; }
  #status #zoom { width: 48px; }
  #st-track, #st-merge { max-width: 7em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

#menu button:focus-visible, #doclist button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
