:root {
  --bg: #f6f1e7; --ink: #2a2622; --mute: #6f665a; --line: rgba(60,45,25,.14);
  --panel: #fbf8f1; --panel-2: #f1ebdf; --glass: rgba(251,248,241,.9);
  --accent: #2a2622; --on-accent: #f6f1e7;
  --gap: #c9a227; --gap-wash: rgba(201,162,39,.08); --gap-ink: #7a6214;
  --warn: #a4442c;
  --sub: #2c5fc7; --sub-wash: rgba(44,95,199,.06);
  --ok: #3f7a52;
  --fb: #b0476f;
  --p-m: #2f6fb3; --p-f: #b7791f; --p-g: #7b4fb0; --p-a: #3c7d4f; --p-u: #7f786d; --p-x: #2a8a87;
  --hl-sel: rgba(255,208,0,.42); --hl-anchor: rgba(201,162,39,.16); --hl-target: rgba(255,208,0,.42); --hl-prop: rgba(164,68,44,.18);
  --serif: "EB Garamond", Georgia, "Times New Roman", serif;
  --ui: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --book: 620px;
  --drawer: 360px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #1c1a17; --ink: #e6dfd2; --mute: #a39b8e; --line: rgba(255,235,200,.12);
  --panel: #23201c; --panel-2: #2b2722; --glass: rgba(35,32,28,.9);
  --accent: #e6dfd2; --on-accent: #1c1a17;
  --gap: #c9a227; --gap-wash: rgba(201,162,39,.07); --gap-ink: #e0c35c;
  --warn: #e07a5f;
  --sub: #8fb0ff; --sub-wash: rgba(143,176,255,.08); --fb: #e892b6; --ok: #8cc79f;
  --p-m: #7fb2ea; --p-f: #e2a64f; --p-g: #b493e0; --p-a: #7cc492; --p-u: #a39b8e; --p-x: #6cc9c4;
  --hl-sel: rgba(255,200,40,.34); --hl-anchor: rgba(201,162,39,.16); --hl-target: rgba(255,200,40,.34); --hl-prop: rgba(224,122,95,.2);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c1a17; --ink: #e6dfd2; --mute: #a39b8e; --line: rgba(255,235,200,.12);
    --panel: #23201c; --panel-2: #2b2722; --glass: rgba(35,32,28,.9);
    --accent: #e6dfd2; --on-accent: #1c1a17;
    --gap-ink: #e0c35c; --warn: #e07a5f;
    --sub: #8fb0ff; --sub-wash: rgba(143,176,255,.08); --fb: #e892b6; --ok: #8cc79f;
    --p-m: #7fb2ea; --p-f: #e2a64f; --p-g: #b493e0; --p-a: #7cc492; --p-u: #a39b8e; --p-x: #6cc9c4;
    --hl-sel: rgba(255,200,40,.34); --hl-target: rgba(255,200,40,.34);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
html { touch-action: manipulation; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 var(--ui); -webkit-font-smoothing: antialiased; overflow: hidden; }
body.loading #canvas { visibility: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible { outline: 2px solid var(--gap); outline-offset: 2px; }
[contenteditable]:focus-visible, textarea:focus-visible, input:focus-visible, select:focus-visible { outline: none; box-shadow: inset 0 -2px 0 var(--gap); }
.phone-only { display: none !important; }

#topbar { position: fixed; inset: 0 0 auto 0; height: 64px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 16px 0 44px; z-index: 30; background: linear-gradient(var(--bg) 84%, color-mix(in srgb, var(--bg) 0%, transparent)); }
#topbar > * { opacity: 1; transition: opacity .2s; }
body.typing #topbar > * { opacity: .55; }
#topbar:hover > *, #topbar:focus-within > *, body.touch #topbar > * { opacity: 1; }
.tb-right { justify-self: end; display: flex; gap: 6px; align-items: center; }
.tb-center { text-align: center; min-width: 0; }
#docTitle { margin: 0; font: 500 17px/1.2 var(--serif); letter-spacing: .14em; text-transform: uppercase; outline: none; padding: 2px 6px; border-radius: 4px; display: inline-block; max-width: 60vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#docTitle:focus { background: none; text-transform: none; letter-spacing: .02em; box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--gap) 70%, transparent); }
.meta { display: block; margin: 2px auto 0; border: 0; background: none; color: var(--mute); font-size: 12px; padding: 2px 6px; border-radius: 4px; }
.meta .warn { color: var(--warn); font-weight: 600; }
.meta { cursor: pointer; transition: background .15s, color .15s; }
.meta .chev { font-size: 9px; margin-left: 2px; opacity: .8; }
.meta:hover, .meta:focus-visible, .meta[aria-expanded="true"] { color: var(--ink); background: color-mix(in srgb, var(--gap) 14%, transparent); }
.wheel { display: inline-block; height: 1.3em; line-height: 1.3em; overflow: hidden; vertical-align: bottom; -webkit-mask-image: linear-gradient(transparent, #000 28%, #000 72%, transparent); mask-image: linear-gradient(transparent, #000 28%, #000 72%, transparent); }
.wheel .wn { display: block; height: 1.3em; text-align: center; font-variant-numeric: tabular-nums; }
.wcol { display: block; transform: translateY(0); }
.wcol.go { transform: translateY(-1.3em); transition: transform .55s cubic-bezier(.3,.7,.2,1); }
.quiet { border: 1px solid transparent; background: none; color: var(--mute); padding: 6px 10px; border-radius: 999px; font-size: 12.5px; min-height: 32px; }
.quiet:hover, .quiet[aria-pressed="true"] { border-color: var(--line); color: var(--ink); background: var(--panel); }
.icon { border: 0; background: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: var(--mute); }
.icon:hover { color: var(--ink); background: var(--panel); }
.icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.i-sun { display: none; }
:root[data-theme="dark"] .i-sun { display: block; } :root[data-theme="dark"] .i-moon { display: none; }

.pop { position: fixed; top: 58px; left: 50%; transform: translateX(-50%); width: min(380px, calc(100vw - 32px)); max-height: calc(100dvh - 76px); overflow-y: auto; overscroll-behavior: contain; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; z-index: 40; box-shadow: 0 10px 30px rgba(0,0,0,.12); }
.pop dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0 0 10px; font-size: 12.5px; }
.pop dt { color: var(--mute); } .pop dd { margin: 0; }
.pop .row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pop .note { font-size: 11.5px; color: var(--mute); margin: 8px 0 0; }

#rail { position: fixed; left: 0; top: 64px; bottom: 112px; width: 46px; z-index: 25; display: flex; align-items: center; }
#rail .shape { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding-left: 10px; max-height: 100%; }
#rail .blk { position: relative; flex: none; border: 0; padding: 0; border-radius: 3px; background: color-mix(in srgb, var(--ink) 18%, transparent); cursor: pointer; transition: background .15s; }
#rail .blk::after { content: ""; position: absolute; inset: -1px -8px -1px -10px; }
#rail .blk:hover, #rail .blk:focus-visible, #rail .blk.here { background: color-mix(in srgb, var(--ink) 32%, transparent); outline: none; }
#rail .blk:focus-visible { box-shadow: 0 0 0 2px var(--gap); }
#rail .blk .fill { position: absolute; left: 0; top: 0; width: 100%; height: 0; border-radius: 3px; background: var(--gap); opacity: .6; pointer-events: none; }
#rail .blk.is-gap { background: none; border: 1.5px dashed var(--gap); }
#rail .blk.is-ex::before { content: ""; position: absolute; right: -6px; top: 2px; width: 4px; height: 4px; border-radius: 50%; background: var(--gap); }
#rail .part-back { border: 0; background: none; color: var(--mute); font-size: 11px; padding: 2px 0 6px; cursor: pointer; }
.rail-tip { position: fixed; left: 52px; z-index: 26; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 7px 11px; max-width: 280px; font-size: 12px; pointer-events: none; box-shadow: 0 6px 18px rgba(0,0,0,.12); opacity: 0; transform: translateX(-6px); transition: opacity .16s ease, transform .2s cubic-bezier(.2,.8,.2,1), top .12s ease-out; }
.rail-tip.show { opacity: 1; transform: none; }
.rail-tip b { display: block; font-weight: 600; } .rail-tip span { color: var(--mute); font-family: var(--serif); font-size: 14px; display: block; } .rail-tip em { display: block; font-style: normal; color: var(--mute); font-size: 11px; margin-top: 3px; }

#scroller { position: fixed; inset: 0; overflow-y: auto; overflow-x: hidden; outline: none; scroll-padding-top: 96px; }
#canvas { position: relative; width: calc(var(--book) + 112px); margin: 0 auto; padding: 96px 56px 240px; font: calc(20px * var(--read-scale, 1))/1.55 var(--read-font, var(--serif)); transition: transform .28s ease; transform-origin: 50% 0; }
body.font-fallback #canvas { font-family: Georgia, serif; }
.fixture-note { font: 11.5px/1.4 var(--ui); color: var(--mute); text-align: center; letter-spacing: .02em; margin: 0 0 1em; }
.chapter { position: relative; }
.chapter h2 { text-align: center; font-weight: 400; font-size: 1.6em; margin: 3.2em 0 1.6em; letter-spacing: .06em; }
.chapter:first-child h2 { margin-top: 1.2em; }

.chapter.empty h2 { margin: 1.9em 0 .9em; }
.chapter.empty + .chapter h2 { margin-top: 1.9em; }
.write-line { outline: none; min-height: 1.55em; padding: 4px 0; margin: .2em 0 .4em; border-bottom: 1px dashed color-mix(in srgb, var(--mute) 35%, transparent); caret-color: var(--ink); cursor: text; text-indent: 0; }
.write-line:empty::before { content: "Click to write…"; font-style: italic; color: var(--mute); pointer-events: none; }
.write-line:focus { border-bottom-color: var(--gap); }
.write-line:focus:empty::before { content: ""; }
body.review .write-line { display: none; }
.chapter h2 .lbl { display: block; font-size: .5em; letter-spacing: .3em; text-transform: uppercase; color: var(--mute); margin-bottom: .4em; }
.chapter h2 .ct { outline: none; border-radius: 4px; padding: 0 4px; }
.chapter h2 .ct:focus { background: none; box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--gap) 70%, transparent); }
.ch-tools { position: absolute; right: -44px; top: 3.4em; opacity: 0; transition: opacity .15s; }
.chapter:hover .ch-tools, .ch-tools:focus-within, body.touch .ch-tools { opacity: 1; }
.ch-tools > button { border: 0; background: none; color: var(--mute); width: 32px; height: 32px; border-radius: 50%; font-size: 18px; line-height: 1; }
.ch-tools > button:hover { background: var(--panel); color: var(--ink); }
.menu { position: absolute; right: 0; top: 34px; z-index: 20; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 4px; width: 250px; font: 13px/1.35 var(--ui); box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 6px; }
.menu button:hover, .menu button:focus-visible { background: var(--panel-2); }
.menu small { display: block; color: var(--mute); font-size: 11.5px; }
.menu .danger-item { color: #b3261e; }

.host { outline: none; caret-color: var(--ink); }
.host:focus, .host:focus-visible { outline: none; }
.host ::selection { background: transparent; color: inherit; }
body.sel-raw .host ::selection { background: var(--hl-sel); }
.host p { margin: 0; text-indent: 1.5em; text-align: justify; hyphens: auto; -webkit-hyphens: auto; min-height: 1.55em; }
.host p.first { text-indent: 0; }
.host p.first::first-letter { font-size: 3.1em; float: left; line-height: .85; padding: .06em .08em 0 0; }
.host p.sample { position: relative; }
.host p.first.sample { text-indent: 0; }
.host p.first.sample::first-letter { font-size: inherit; float: none; line-height: inherit; padding: 0; }
.host p.sample { box-shadow: -10px 0 0 -7px var(--gap); background: color-mix(in srgb, var(--gap) 7%, transparent); }
.host p.sample::before { content: "AI example · provisional"; position: absolute; left: -9.5em; width: 8.5em; text-align: right; top: .35em; font: 10.5px/1.2 var(--ui); color: var(--gap-ink); text-indent: 0; }
.host + .host { margin-top: 0; }
.burn-fx { position: absolute; z-index: 4; pointer-events: none; }

.chapter.revealing { overflow: hidden; transition: height .68s cubic-bezier(.22,.8,.24,1); -webkit-mask-image: linear-gradient(#000 calc(100% - 70px), transparent); mask-image: linear-gradient(#000 calc(100% - 70px), transparent); }
.chapter.revealing .host { animation: reveal-in .7s ease-out both; }
@keyframes reveal-in { from { opacity: 0; filter: blur(1.5px); } to { opacity: 1; filter: none; } }

#book .gap { margin: 1em 0; border: 1.5px dashed var(--gap); background: var(--gap-wash); border-radius: 10px; padding: 10px 14px 8px; font: 13px/1.45 var(--ui); }
.gap .g-row { display: flex; gap: 10px; align-items: baseline; }
.gap .g-lbl { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--gap-ink); font-weight: 600; flex: none; }
.gap .g-purpose { flex: 1; font: italic 400 17px/1.4 var(--serif); margin: 0; outline: none; border-radius: 4px; padding: 0 3px; }
.gap .g-purpose:focus { background: none; box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--gap) 70%, transparent); }
.gap .g-dec { list-style: none; margin: 6px 0 0; padding: 0; font-size: 12.5px; }
.gap .g-dec li { margin-top: 2px; } .gap .g-dec b { color: var(--gap-ink); }
.gap .g-src { color: var(--mute); font-size: 11px; }
.gap .g-acts { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 4px; }
.g-btn { border: 0; background: none; color: var(--mute); padding: 4px 8px; border-radius: 6px; font-size: 12px; min-height: 28px; }
.g-btn:hover, .g-btn:focus-visible { background: var(--panel); color: var(--ink); }
.g-btn.g-write { color: var(--ink); font-weight: 600; }
.g-btn.g-info { margin-left: auto; }
.gap .g-more { font-size: 12px; color: var(--mute); margin: 4px 0 2px; display: grid; gap: 2px; }
.gap .g-more b { color: var(--ink); font-weight: 600; }
.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 5px 12px; min-height: 32px; font-size: 12.5px; }
.btn:hover { border-color: var(--mute); }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.btn.warn { color: var(--warn); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.choices { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 6px; }
.choices li { display: flex; gap: 8px; align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: var(--bg); font: 15px/1.35 var(--serif); }
.choices em { font: 11.5px var(--ui); color: var(--gap-ink); white-space: nowrap; }
.choices .btn { white-space: nowrap; font-family: var(--ui); }

.sel-tools { position: absolute; z-index: 6; display: flex; gap: 2px; padding: 3px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; box-shadow: 0 4px 14px rgba(0,0,0,.12); font: 12.5px/1 var(--ui); }
.sel-tools button { border: 0; background: none; border-radius: 999px; padding: 6px 11px; color: var(--ink); }
.sel-tools button:hover, .sel-tools button:focus-visible { background: var(--panel-2); }
.sel-tools.fixed { position: fixed; left: 50% !important; transform: translateX(-50%); bottom: 168px; top: auto !important; z-index: 47; }
.sel-tools.fixed button { padding: 10px 14px; font-size: 14px; }
.para-dot { position: absolute; left: 36px; width: 14px; height: 14px; margin-top: -7px; border-radius: 50%; border: 1.5px solid var(--mute); background: var(--bg); padding: 0; z-index: 5; opacity: .7; transition: transform .15s, opacity .15s; }
.para-dot::after { content: ""; position: absolute; left: -10px; top: -10px; right: -10px; bottom: -10px; }
.para-dot:hover { opacity: 1; transform: scale(1.15); }
.para-dot.on { background: var(--gap); border-color: var(--gap); opacity: 1; }

.prov-on .host span[data-p="m"] { text-decoration: underline dotted var(--p-m) 2px; text-underline-offset: 3px; }
.prov-on .host span[data-p="f"] { text-decoration: underline wavy var(--p-f) 1.5px; text-underline-offset: 4px; }
.prov-on .host span[data-p="g"] { text-decoration: underline dashed var(--p-g) 1.5px; text-underline-offset: 4px; }
.prov-on .host span[data-p="a"] { text-decoration: underline double var(--p-a) 1.5px; text-underline-offset: 3px; }
.prov-on .host span[data-p="x"] { text-decoration: underline solid var(--p-x) 2px; text-underline-offset: 4px; }
.prov-on .host span[data-p="u"] { color: color-mix(in srgb, var(--ink) 70%, var(--p-u)); text-decoration: underline solid color-mix(in srgb, var(--p-u) 60%, transparent) 1px; text-underline-offset: 4px; }
.legend { position: fixed; right: 16px; top: 68px; transition: right .2s; z-index: 29; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 12px; width: 230px; }
body.hist-open .legend { right: calc(var(--drawer) + 12px); }
.ai-box .host span[data-p="g"], .ai-box .host span[data-p="f"] { box-shadow: 0 0 0 1.5px var(--gap); border-radius: 3px; -webkit-box-decoration-break: clone; box-decoration-break: clone; text-decoration: none !important; }
.ai-box-btn { margin-top: 10px; width: 100%; }
.ai-box-btn[aria-pressed="true"] { border-color: var(--gap); background: var(--gap-wash); }
.ai-nav { position: fixed; right: 16px; bottom: 120px; z-index: 33; display: flex; align-items: center; gap: 4px; background: var(--panel); border: 1px solid var(--gap); border-radius: 999px; padding: 4px 4px 4px 14px; font-size: 12.5px; box-shadow: 0 6px 18px rgba(0,0,0,.1); }
.ai-nav button { border: 0; background: none; border-radius: 999px; min-width: 34px; height: 34px; padding: 0 10px; font-size: 14px; }
.ai-nav button:hover, .ai-nav button:focus-visible { background: var(--gap-wash); }
.legend ul { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; }
.legend li { display: flex; gap: 8px; align-items: baseline; }
.legend .sw { font: 15px var(--serif); width: 34px; text-align: center; text-underline-offset: 3px; }
.legend .n { margin-left: auto; color: var(--mute); }
.legend p { margin: 6px 0 0; color: var(--mute); font-size: 11px; }

::highlight(shape-anchor) { text-decoration: underline 1.5px color-mix(in srgb, var(--gap) 80%, transparent); text-underline-offset: 5px; }
::highlight(shape-target) { background-color: var(--hl-target); }
::highlight(shape-prop) { text-decoration: underline 2px var(--warn); text-underline-offset: 4px; }
::highlight(shape-new) { background-color: color-mix(in srgb, var(--gap) calc(var(--glow, 0) * 34%), transparent); text-decoration: underline 2px color-mix(in srgb, var(--gap) calc(var(--glow, 0) * 100%), transparent); text-underline-offset: 4px; }
::highlight(shape-flash) { text-decoration: underline 3px var(--gap); text-underline-offset: 4px; }

.drawer { position: fixed; top: 64px; bottom: 112px; width: var(--drawer); z-index: 28; background: var(--panel); border: 1px solid var(--line); display: flex; flex-direction: column; box-shadow: 0 8px 30px rgba(0,0,0,.08); }
.drawer.left { left: 30px; border-radius: 0 14px 14px 0; border-left: 0; }
.drawer.right { right: 0; border-radius: 14px 0 0 14px; border-right: 0; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--line); }
.drawer-body { overflow-y: auto; padding: 12px 14px 20px; flex: 1; }
.tabs { display: flex; gap: 4px; }
.tabs button { border: 0; background: none; padding: 6px 10px; border-radius: 999px; color: var(--mute); font-size: 13px; }
.tabs [aria-selected="true"] { background: var(--panel-2); color: var(--ink); font-weight: 600; }
.empty { color: var(--mute); font-size: 13px; }

.thread { border-bottom: 1px solid var(--line); padding: 12px 0; }
.thread:last-child { border-bottom: 0; }
.t-target { display: block; width: 100%; text-align: left; border: 0; background: var(--panel-2); border-radius: 8px; padding: 6px 9px; font-size: 11.5px; color: var(--mute); }
.t-target q { display: block; font: italic 14.5px/1.35 var(--serif); color: var(--ink); margin-top: 2px; quotes: "\201C" "\201D"; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.t-target .bad { color: var(--warn); font-weight: 600; }
.t-msg { margin: 8px 0 0; white-space: pre-wrap; }
.t-msg .who { color: var(--mute); font-size: 11.5px; display: block; }
.t-reply { margin-top: 8px; padding-left: 10px; border-left: 2px solid var(--line); }
.t-reply .demo { font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase; color: var(--mute); }
.t-reply p { margin: 3px 0 0; }
.rt p { margin: 0 0 6px; white-space: pre-wrap; }
.rt p:last-child { margin-bottom: 0; }
.rt .rt-h { font-weight: 600; margin-top: 10px; }
.rt ul, .rt ol { margin: 2px 0 8px; padding-left: 20px; }
.rt li { margin: 2px 0; }
.rt a { color: inherit; text-decoration: underline; text-underline-offset: 2px; word-break: break-all; }
.set-acts { align-items: center; gap: 8px; flex-wrap: wrap; }
.chip.reply { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-reply details { margin-top: 4px; font-size: 13px; color: var(--mute); }
.pending { color: var(--mute); font-style: italic; }
.pending::after { content: " …"; animation: dots 1.2s steps(3) infinite; }
@keyframes dots { 50% { opacity: .3; } }
.opts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.prop { margin-top: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--bg); }
.prop .kind { font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase; font-weight: 600; }
.prop .kind.m { color: var(--p-m); } .prop .kind.f { color: var(--p-f); } .prop .kind.g { color: var(--p-g); }
.prop .diff { font: 15px/1.4 var(--serif); margin: 4px 0; }
.prop del { color: var(--warn); text-decoration: line-through; }
.prop ins { text-decoration: none; background: color-mix(in srgb, var(--p-a) 18%, transparent); }
.prop .acts { display: flex; flex-wrap: wrap; gap: 6px; }
.prop .state { font-size: 12px; color: var(--mute); }
.prop.conflict { border-color: var(--warn); }
.prop.conflict .state { color: var(--warn); }
.prop.done { opacity: .7; }

.ev { border-bottom: 1px solid var(--line); padding: 10px 0; font-size: 12.5px; }
.ev .h { display: flex; gap: 6px; flex-wrap: wrap; align-items: baseline; }
.ev .h b { font-weight: 600; }
.ev .h select { font-size: 11.5px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 6px; padding: 1px 4px; }
.ev .by { color: var(--mute); }
.ev .d { font: 14px/1.4 var(--serif); margin-top: 4px; }
.ev .d del { color: var(--warn); } .ev .d ins { text-decoration: none; background: color-mix(in srgb, var(--p-a) 18%, transparent); }
.pass { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; font-size: 12.5px; }
.pass.rejected { border-style: dashed; opacity: .75; }
.pass q { display: block; font: italic 14px/1.35 var(--serif); margin: 4px 0; }
.pass .acts { display: flex; gap: 6px; flex-wrap: wrap; }

#bar { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); width: min(720px, calc(100vw - 32px)); z-index: 31; background: var(--glass); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); contain: layout paint; border: 1px solid var(--line); border-radius: 16px; padding: 8px 10px 6px; box-shadow: 0 6px 24px rgba(0,0,0,.07); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { #bar { background: var(--panel); } }
.scope-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; padding: 0 2px 6px; }
.scope-lbl { color: var(--mute); }
.chip { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 3px 10px; font-size: 12px; max-width: 60ch; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip.frozen { border-color: var(--gap); background: color-mix(in srgb, var(--gap) 16%, var(--panel)); }
.chipgrp { display: inline-flex; align-items: center; min-width: 0; max-width: 100%; }
.chipgrp .chip { min-width: 0; }
.chip-x { flex: none; border: 0; background: none; color: var(--mute); width: 26px; height: 26px; border-radius: 50%; font-size: 17px; line-height: 1; margin-left: -4px; }
.chip-x:hover, .chip-x:focus-visible { background: var(--panel); color: var(--ink); }
.quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 2px 6px; }
.quick button { border: 1px dashed var(--gap); background: none; border-radius: 999px; padding: 3px 10px; font-size: 12px; color: var(--ink); }
.quick button:hover { background: var(--gap-wash); }
.chip.ghost { background: none; color: var(--mute); }
.only-ai { font-size: 12px; color: var(--mute); display: flex; gap: 4px; align-items: center; }
.input-row { display: flex; gap: 6px; align-items: flex-end; }
#input { flex: 1; resize: none; border: 0; background: none; font: 15px/1.4 var(--ui); color: var(--ink); padding: 6px 4px; max-height: 140px; outline: none; }
.send { border: 0; background: var(--accent); color: var(--on-accent); border-radius: 999px; padding: 7px 16px; font-weight: 600; font-size: 13px; min-height: 34px; }
.bar-hint { margin: 2px 4px 0; font-size: 11.5px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sheet { position: fixed; inset: auto 0 0 0; max-height: 72vh; z-index: 45; background: var(--panel); border-radius: 16px 16px 0 0; border: 1px solid var(--line); overflow-y: auto; padding: 8px 16px 24px; box-shadow: 0 -10px 30px rgba(0,0,0,.15); }
.sheet button.ch { display: flex; width: 100%; gap: 10px; text-align: left; border: 0; background: none; padding: 10px 4px; border-bottom: 1px solid var(--line); font: 17px var(--serif); }
.sheet button.ch small { font: 12px var(--ui); color: var(--mute); width: 46px; padding-top: 3px; }
.sheet button.ch.is-gap { color: var(--gap-ink); font-style: italic; }

#bar.rw-on .scope-row, #bar.rw-on #quick, #bar.rw-on .input-row, #bar.rw-on > .bar-hint { display: none; }
.rw-head { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 0 2px 6px; }
.rw-src { color: var(--mute); font-size: 12px; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; flex: 1; }
.rw details { margin: 0 2px 8px; font-size: 12px; color: var(--mute); }
.rw summary { cursor: pointer; width: max-content; }
.rw-orig { margin-top: 4px; max-height: min(120px, 16vh); overflow-y: auto; padding: 8px 10px; border-left: 2px solid var(--gap); background: color-mix(in srgb, var(--gap) 7%, transparent); border-radius: 0 6px 6px 0; font: 15px/1.45 var(--serif); color: var(--ink); white-space: pre-wrap; user-select: text; }
.rw-lbl { display: block; font-size: 12px; color: var(--mute); margin: 0 2px 4px; }
#rwText { width: 100%; resize: none; max-height: 30vh; border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 10px; padding: 10px 12px; font: 17px/1.5 var(--serif); outline: none; min-height: 96px; }
#rwText:focus { border-color: var(--gap); }
.rw-acts { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.rw-msg { flex: 1; font-size: 12px; color: var(--mute); }
.rw-msg.warn { color: var(--warn); }
.linkish { border: 0; background: none; color: var(--ink); text-decoration: underline; padding: 0 2px; font-size: 12px; }
.chip.resume { border-style: dashed; border-color: var(--gap); }
.head-acts { display: flex; align-items: center; gap: 2px; }
.drawer { transition: right .26s cubic-bezier(.2,.8,.2,1); }

.undo-grp { position: relative; display: inline-flex; align-items: center; }
.undo-grp .icon { width: 32px; height: 32px; }
.undo-grp .icon[disabled] { opacity: .35; cursor: default; background: none; }
.caret-btn { width: 18px !important; font-size: 10px; margin-left: -6px; }
.undo-menu { right: auto; left: 0; top: 36px; width: 280px; }
.describe-pop { left: auto; right: 16px; transform: none; top: 58px; }
.describe-pop input { width: 100%; border: 1px dashed var(--line); background: var(--bg); border-radius: 999px; padding: 7px 12px; font: 13px var(--ui); color: var(--mute); margin-top: 4px; }

.restore-demo { position: fixed; left: 44px; bottom: 22px; z-index: 34; border: 1px solid var(--line); background: var(--panel); color: var(--mute); border-radius: 999px; padding: 7px 12px; font-size: 12px; box-shadow: 0 4px 14px rgba(0,0,0,.06); }
.restore-demo:hover, .restore-demo:focus-visible { color: var(--ink); }

.dlg-wrap { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 55%, rgba(0,0,0,.35)); padding: 16px; }
.dlg { width: min(400px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px 22px 16px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.dlg h2 { margin: 0 0 6px; font: 500 22px/1.25 var(--serif); }
.dlg p { margin: 0 0 16px; color: var(--mute); font-size: 13.5px; }
.dlg-acts { display: flex; justify-content: flex-end; gap: 8px; }
.btn.danger { background: #b3261e; color: #fff; border-color: transparent; }
.btn.danger:hover { background: #9a1f18; }

.cbox { position: absolute; z-index: 7; background: var(--panel); border: 1px solid var(--gap); border-radius: 12px; padding: 8px 10px 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); font: 14px/1.45 var(--ui); }
.cbox textarea { width: 100%; resize: none; border: 0; background: none; color: var(--ink); font: 16px/22px var(--ui); outline: none; overflow-y: auto; padding: 2px; }
.cbox-acts { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.cbox-hint { flex: 1; font-size: 11px; color: var(--mute); }
.sel-tools .primary-sa { font-weight: 600; }

.ws { position: fixed; left: 50%; transform: translateX(-50%); width: min(720px, calc(100vw - 32px)); z-index: 31; display: flex; flex-direction: column; }
.ws-tabs { display: flex; align-items: center; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-bottom: 0; border-radius: 14px 14px 0 0; padding: 5px 8px 0; width: max-content; max-width: 100%; margin: 0 auto -1px; position: relative; z-index: 1; }
.ws.closed .ws-tabs { border-radius: 14px; border-bottom: 1px solid var(--line); padding-bottom: 5px; margin-bottom: 0; box-shadow: 0 4px 14px rgba(0,0,0,.07); }
.ws-tab { border: 0; background: none; border-radius: 8px 8px 0 0; padding: 6px 12px 8px; font: 12.5px var(--ui); color: var(--mute); display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.ws.closed .ws-tab { border-radius: 8px; padding-bottom: 6px; }
.ws-tab[aria-selected="true"] { color: var(--ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--ink); }
.ws.closed .ws-tab[aria-selected="true"] { box-shadow: none; }
.ws-tab b { background: var(--gap); color: #2a2622; border-radius: 999px; min-width: 18px; padding: 0 6px; font-size: 11px; font-weight: 600; text-align: center; }
.ws-tab.conv b { background: var(--panel-2); color: var(--ink); }
.ws-tab.pulse { animation: pulse .6s ease; }
@keyframes pulse { 40% { transform: scale(1.08); } }
.ws-ctl { display: flex; gap: 2px; margin-left: 8px; padding-left: 8px; border-left: 1px solid var(--line); }
.ws-ctl button { border: 0; background: none; color: var(--mute); border-radius: 6px; padding: 4px 8px; font: 12px var(--ui); white-space: nowrap; }
.ws-ctl button:hover, .ws-ctl button:focus-visible { color: var(--ink); background: var(--panel-2); }
.ws-body { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.1); height: min(42vh, 380px); display: flex; flex-direction: column; overflow: hidden; transition: height .26s cubic-bezier(.2,.8,.2,1); }
.ws-pane { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.ws-pane[hidden] { display: none !important; }
.cq-list, .ws-scroll { overflow-y: auto; padding: 10px 14px; flex: 1; min-height: 0; }
.cq-list { display: grid; gap: 8px; align-content: start; }
.cq-card { border: 1px solid var(--line); border-left: 3px solid var(--gap); border-radius: 10px; padding: 8px 10px; background: var(--bg); }
.cq-quote { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 0; }
.cq-meta { display: block; font-size: 11px; color: var(--mute); }
.cq-quote q { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font: italic 14.5px/1.35 var(--serif); color: var(--ink); quotes: "\201C" "\201D"; }
.cq-text { margin: 4px 0 2px; font-size: 13.5px; white-space: pre-wrap; }
.cq-reply { margin: 6px 0 4px; padding: 6px 0 0 10px; border-left: 2px solid var(--line); }
.cq-reply .who { display: block; font-size: 11.5px; color: var(--mute); margin-bottom: 2px; }
.cq-reply p { margin: 0; font-size: 13.5px; white-space: pre-wrap; }
.cq-reply .prop { margin-top: 6px; }
#editsHint { color: var(--ink); }
.tab-lock { position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(2px); padding: 16px; }
.tab-lock-box { max-width: 420px; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; box-shadow: 0 10px 40px rgb(0 0 0 / .25); }
.tab-lock-box p { margin: 0 0 12px; line-height: 1.45; }
.cq-acts { display: flex; align-items: center; gap: 6px; }
.cq-state { flex: 1; font-size: 11px; color: var(--mute); }
.cq-foot { display: flex; align-items: center; gap: 10px; padding: 8px 14px 10px; border-top: 1px solid var(--line); }
.cq-foot .note { font-size: 11px; color: var(--mute); }
.cq-foot .btn { white-space: nowrap; flex: none; }
.bridge-note { margin: 0; padding: 6px 14px 0; font-size: 12px; color: var(--mute); }
.bridge-note:empty { display: none; }
.bridge-note b { color: var(--ink); }
body.review #wsTabConv, body.review #expandBtn { display: none; }

.send { display: inline-flex; align-items: center; gap: 6px; }
.send svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; }

.review-btn { display: inline-flex; align-items: center; gap: 5px; }
.review-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; }

body.review #bar, body.review .ch-tools, body.review #paraDot, body.review .gap .g-acts, body.review #disc-toggle, body.review .disc-toggle,
body.review #provBtn, body.review #histBtn, body.review .restore-demo { display: none !important; }

.review-pill { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 30; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 4px 6px 4px 14px; font-size: 12px; color: var(--mute); box-shadow: 0 4px 14px rgba(0,0,0,.06); width: max-content; max-width: calc(100vw - 24px); }
@media (max-width: 600px) { .review-pill { border-radius: 14px; } }
.review-pill button { border: 0; background: var(--accent); color: var(--on-accent); border-radius: 999px; padding: 4px 10px; font-size: 12px; margin-left: 4px; }
.host p.br { text-align: center; text-indent: 0; color: var(--mute); margin: .8em 0; }
.dlg.wide { width: min(640px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
#mdlBody { overflow-y: auto; display: grid; gap: 10px; margin-bottom: 12px; }
#mdlBody textarea { width: 100%; resize: vertical; border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 10px; padding: 10px 12px; font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; }
#mdlBody .note { margin: 0; color: var(--mute); font-size: 12.5px; }
.fld { display: grid; gap: 4px; font-size: 12.5px; color: var(--mute); }
.fld + .fld { margin-top: 10px; }
.fld input[type=text], .fld select { border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 8px; padding: 7px 10px; font: 14px var(--ui); }
.fld.chk { display: flex; align-items: center; gap: 6px; }
.imp-preview { margin: 0; font-size: 12.5px; color: var(--ink); min-height: 1em; }
.mdl-msg { flex: 1; font-size: 12px; color: var(--warn); align-self: center; }
.projects { display: grid; gap: 4px; margin: 10px 0; padding-top: 10px; border-top: 1px solid var(--line); }
.projects b { font-size: 12px; }
.proj { text-align: left; border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 6px 10px; font-size: 13px; }
.proj small { color: var(--mute); margin-left: 6px; }
.proj.cur { border-color: var(--gap); }
.t-reply .q { margin: 4px 0 0; font-size: 13.5px; }
.host p.center { text-align: center; text-indent: 0; letter-spacing: .04em; }
.side-summary { margin: 0; font-size: 12.5px; color: var(--ink); background: var(--panel-2); border-radius: 8px; padding: 8px 10px; }
.side-summary .warn, .lineage .warn { color: var(--warn); }
.lineage { border: 1px solid var(--line); border-left: 3px solid var(--p-x); border-radius: 10px; padding: 8px 10px; margin-bottom: 10px; font-size: 12.5px; }
.lineage .cls { color: var(--mute); }
.lineage p { margin: 4px 0 0; }
.lineage ul { margin: 6px 0 0; padding-left: 16px; display: grid; gap: 4px; }
.lineage q { font: italic 13.5px/1.35 var(--serif); }
.lineage code { font-size: 11px; }
body.no-headings .chapter h2 { display: none; }
body.no-headings .chapter .ch-tools { top: 0; }
body.no-headings .chapter + .chapter { margin-top: 1.4em; }
.book-title { text-align: center; font: 400 2.2em/1.2 var(--serif); letter-spacing: .16em; margin: 1.4em 0 1.6em; }
.continue-btn { display: block; margin: 2.2em auto 0; border: 1px dashed color-mix(in srgb, var(--mute) 50%, transparent); background: none; color: var(--mute); border-radius: 999px; padding: 6px 16px; font: 13px var(--ui); }
.continue-btn:hover, .continue-btn:focus-visible { color: var(--ink); border-color: var(--gap); }
body.review .continue-btn { display: none; }
.help-btn { position: fixed; right: 18px; bottom: 22px; z-index: 34; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--mute); font: 600 16px/1 var(--ui); box-shadow: 0 4px 14px rgba(0,0,0,.08); transition: color .15s, transform .2s cubic-bezier(.2,.8,.2,1); }
.help-btn:hover, .help-btn[aria-expanded="true"] { color: var(--ink); transform: scale(1.06); }
.help-panel { position: fixed; right: 18px; bottom: 70px; z-index: 35; width: min(320px, calc(100vw - 36px)); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; font-size: 13px; box-shadow: 0 10px 30px rgba(0,0,0,.14); }
.help-panel .soon { color: var(--mute); margin: 4px 0 8px; }
.help-panel ul { margin: 0 0 10px; padding-left: 16px; display: grid; gap: 5px; }
.help-panel input { width: 100%; border: 1px dashed var(--line); background: var(--bg); border-radius: 999px; padding: 7px 12px; font: 13px var(--ui); color: var(--mute); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 150px; z-index: 50; background: var(--accent); color: var(--on-accent); border-radius: 999px; padding: 8px 8px 8px 16px; font-size: 13px; display: flex; gap: 10px; align-items: center; box-shadow: 0 6px 20px rgba(0,0,0,.18); max-width: calc(100vw - 32px); }
.toast button { border: 0; background: rgba(127,127,127,.25); color: inherit; border-radius: 999px; padding: 4px 10px; font-weight: 600; }

@media (max-width: 720px) {
  .phone-only { display: inline-flex !important; }
  #rail, .rail-tip { display: none; }
  #topbar { padding: 0 6px; grid-template-columns: auto minmax(0, 1fr) auto; height: 62px; background: var(--bg); border-bottom: 1px solid var(--line); gap: 4px; }
  #topbar > * { opacity: 1; }
  #chapBtn { padding: 6px 6px; }
  #docTitle { max-width: 100%; font-size: 13px; letter-spacing: .1em; }
  .meta { font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  body.hist-open .legend { right: 8px; }
  .tb-right { gap: 0; } .tb-right .quiet { padding: 6px 5px; font-size: 11.5px; } .tb-right .icon { width: 32px; }
  #canvas { width: 100%; padding: 84px 20px 230px; font-size: calc(18px * var(--read-scale, 1)); }
  .ch-tools { right: -14px; opacity: 1; }
  .para-dot:not(.para-dot-r) { display: none !important; }
  .ws { width: calc(100vw - 16px); }
  .ws-ctl #expandBtn { display: none; }
  .ws-tab { padding: 6px 9px 8px; }
  .cq-foot { flex-wrap: wrap; }
  .review-btn .lbl-txt { display: none; }
  #reviewBtn { display: none !important; }
  .more-grp .menu [data-lvl="3"] { display: block; }
  .more-grp { position: relative; }
  #docTitle { font-size: 13px; }
  body.cq-open .restore-demo, body.cq-open .help-btn { display: none; }
  .cbox { left: 8px !important; width: calc(100% - 16px) !important; }
  .restore-demo { left: 8px; font-size: 11px; padding: 6px 10px; }
  .undo-grp .icon { width: 26px; height: 30px; } .caret-btn { width: 14px !important; margin-left: -4px; }
  .undo-menu { left: auto; right: -60px; }
  .rw-acts .quiet { padding: 6px 6px; font-size: 12px; white-space: nowrap; }
  .rw-acts .send { white-space: nowrap; }
  .rw-msg:empty { display: none; }
  .rw-acts { justify-content: flex-end; flex-wrap: wrap; }
  body:has(#bar.rw-on) .help-btn, body:has(#bar.rw-on) .help-panel { display: none; }
  .g-btn { min-height: 40px; padding: 6px 10px; font-size: 13px; }
  .chip-x { width: 36px; height: 36px; }
  .host p.sample::before { position: static; display: block; width: auto; text-align: left; margin-bottom: 2px; }
  .drawer { top: auto; bottom: 0; left: 0 !important; right: 0 !important; width: 100%; height: 72vh; border-radius: 16px 16px 0 0; border: 1px solid var(--line); z-index: 44; }
  #bar { bottom: calc(12px + env(safe-area-inset-bottom)); width: calc(100vw - 40px - env(safe-area-inset-left) - env(safe-area-inset-right)); z-index: 46; }
  .bar-hint { display: none; }
  .legend { top: auto; bottom: 150px; right: 8px; }
  .ai-nav { bottom: auto; top: 68px; right: 8px; }
  .ai-box .legend { display: none; }
  .pop { top: 54px; max-height: calc(100dvh - 54px - 170px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

.focus { position: fixed; inset: 0; z-index: 48; background: var(--bg); color: var(--ink); display: flex; flex-direction: column; }
.focus .f-top, .focus .f-bot { display: flex; align-items: center; gap: 12px; padding: 10px 20px; transition: opacity .25s ease; opacity: .55; }
.focus.show-top .f-top, .focus.show-bot .f-bot, .focus .f-top:focus-within, .focus .f-bot:focus-within { opacity: 1; }
@media (hover: none) { .focus .f-top, .focus .f-bot { opacity: 1; } }
.f-top { justify-content: space-between; }
.f-nav { display: flex; align-items: center; gap: 6px; font: 13px var(--ui); }
.f-nav .icon { font-size: 20px; width: 32px; height: 32px; }
.f-ch input { width: 3.2em; text-align: center; font: inherit; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); padding: 3px 4px; }
.f-ch span { color: var(--mute); }
.f-ch { white-space: nowrap; display: flex; align-items: center; gap: 6px; }
#fChOf { max-width: 28vw; overflow: hidden; text-overflow: ellipsis; }
.f-saved { font-size: 12px; color: var(--mute); min-width: 120px; text-align: right; }
.f-panes { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.f-pane { display: flex; flex-direction: column; min-height: 0; padding: 0 clamp(16px, 4vw, 56px); }
.f-old-pane { border-right: 1px solid var(--line); }
.f-label { font: 11px var(--ui); letter-spacing: .06em; text-transform: uppercase; color: var(--mute); padding: 6px 0 10px; }
.f-text { flex: 1; min-height: 0; overflow-y: auto; font: 19px/1.6 var(--serif); }
.f-old { color: var(--mute); }
.f-old p { margin: 0 0 .9em; transition: color .3s; }
.f-old p.cur { color: var(--ink); }
.f-new { width: 100%; resize: none; border: 0; outline: none; background: transparent; color: var(--ink); padding: 0; }
.f-bot { justify-content: space-between; }
.f-acts { display: flex; gap: 8px; }
body.focus-on #bar, body.focus-on .ws, body.focus-on #rail, body.focus-on .help-btn { visibility: hidden; }
@media (max-width: 720px) {
  .f-panes { grid-template-columns: 1fr; grid-template-rows: 38% 62%; }
  .f-old-pane { border-right: 0; border-bottom: 1px solid var(--line); }
  .f-text { font-size: 17px; }
  .f-bot { flex-wrap: wrap; }
  .f-saved { display: none; }
  .f-top { padding: 8px 12px; }
}

.para-dot-r { left: auto; width: 16px; height: 16px; margin-top: -8px; border-radius: 4px; }
.para-dot-r::after { left: -12px; top: -12px; right: -12px; bottom: -12px; }
.ws-foot-hide { display: none; margin-left: auto; padding: 8px 10px; min-height: 36px; color: var(--mute); white-space: nowrap; }
.ws.expanded .ws-foot-hide { display: inline-flex; align-items: center; }
.prop-talk { margin-top: 8px; padding-left: 10px; border-left: 2px solid var(--line); font-size: 13.5px; }
.pt-msg { margin: 6px 0; }
.pt-msg .who { display: block; font-size: 11px; color: var(--mute); }
.pt-msg p { margin: 0; white-space: pre-wrap; }
.f-bot { position: relative; }
.f-help { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--mute); }
.f-hint { position: absolute; right: 20px; bottom: 64px; z-index: 2; width: min(420px, calc(100vw - 40px)); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 13px; line-height: 1.45; box-shadow: 0 10px 30px rgba(0,0,0,.12); }
.btn.quiet-danger { background: transparent; color: var(--mute); }
.btn.quiet-danger:hover { color: var(--warn); }
.f-new::placeholder { color: var(--mute); opacity: 1; }

.paste-intent { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 4px 2px 8px; font-size: 13px; color: var(--mute); }
#discuss { position: relative; }
.new-reply { position: absolute; left: 50%; transform: translateX(-50%); bottom: 64px; z-index: 3; border: 1px solid var(--gap); background: var(--panel); color: var(--ink); border-radius: 999px; padding: 6px 14px; font-size: 12.5px; box-shadow: 0 6px 18px rgba(0,0,0,.12); }
.cand { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); font-size: 13.5px; }
.cand .opts { margin-top: 8px; }
.focus.cand-mode #fAsk, .focus.cand-mode #fMerge, .focus.cand-mode .f-nav .icon, .focus.cand-mode #fHelp { display: none; }
.focus.cand-mode .f-new { color: var(--ink); }
.next-acts { align-items: center; gap: 6px; flex-wrap: wrap; }
.new-reply.round { width: 36px; height: 36px; padding: 0; border-radius: 50%; font-size: 16px; line-height: 1; border-color: var(--line); color: var(--mute); }
.og-sub { margin: 2px 0 6px; color: var(--mute); font-size: 11px; }
.og-bar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--line); margin-bottom: 8px; }
.og-bar span { display: block; height: 100%; }
.ch-num { font-variant-numeric: lining-nums; }
.ct.unnamed:empty::before { content: attr(data-ph); color: var(--mute); opacity: 0; transition: opacity .15s; }
h2:hover .ct.unnamed:empty::before, .ct.unnamed:focus::before { opacity: .6; }

.sub-layer { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.sub-group { position: absolute; display: flex; flex-direction: column; gap: 6px; pointer-events: auto; }
.subnote { border-left: 2px solid var(--sub); background: var(--sub-wash); color: var(--sub); border-radius: 0 8px 8px 0; padding: 6px 10px; font: 13px/1.45 var(--ui); }
.subnote p { margin: 2px 0 0; }
.subnote .sk { font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase; font-weight: 600; }
.subnote .sq { font-style: italic; opacity: .8; font-size: 12px; }
.subnote .sorig { opacity: .7; font-size: 12px; }
.subnote .sa { display: flex; gap: 10px; margin-top: 4px; }
.subnote .sa button { border: 0; background: none; padding: 2px 0; color: var(--sub); font: 12px var(--ui); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.subnote.k-possible { border-left-style: dashed; }
.subnote.k-author { border-left-width: 3px; }
.subnote.stale { opacity: .6; }
.sub-bar { position: fixed; top: 64px; right: 16px; z-index: 30; display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--sub); color: var(--sub); border-radius: 999px; padding: 4px 6px 4px 14px; font-size: 12.5px; box-shadow: 0 4px 14px rgba(0,0,0,.06); }
#subtextBtn[aria-pressed="true"] { color: var(--sub); }
#cqPane { position: relative; }
.sub-intro { position: fixed; top: 104px; right: 16px; z-index: 31; width: min(360px, calc(100vw - 32px)); background: var(--panel); border: 1px solid var(--sub); border-radius: 12px; padding: 14px 16px; font-size: 13.5px; line-height: 1.5; color: var(--ink); box-shadow: 0 10px 30px rgba(0,0,0,.12); }
.sub-intro b { color: var(--sub); }
.sub-intro p { margin: 6px 0; }
.sub-help { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--sub); background: none; color: var(--sub); font-size: 12px; padding: 0; }
.cq-nav { display: flex; align-items: center; gap: 8px; padding: 8px 14px 4px; border-bottom: 1px solid var(--line); }
.cq-nav #cqAcceptAll { margin-left: auto; }
.cq-step .icon { width: 28px; height: 28px; font-size: 18px; border: 1px solid var(--line); border-radius: 50%; background: var(--panel); color: var(--ink); }
.cq-step .icon:disabled { opacity: .4; }
.cq-card.cq-cur { border-color: var(--gap); box-shadow: 0 0 0 2px var(--gap-wash); }
.cq-card.cq-done { opacity: .6; }
.cq-step { display: inline-flex; gap: 4px; }
.cq-step .icon { display: inline-grid; place-items: center; padding: 0; }
.cq-nav { flex-wrap: nowrap; min-height: 40px; }
.cq-list .prop.cur { outline: 2px solid var(--gap); outline-offset: 2px; border-radius: 8px; }
.f-old .f-ch-h { color: var(--ink); font: 600 12px var(--ui); letter-spacing: .06em; margin: 1.6em 0 .6em; }

#book.verse .host p { text-indent: 0 !important; margin: 0; text-align: left; }
.host p.grp { border-left: 2px solid var(--line); padding-left: 10px; margin-left: -12px; }
@keyframes revealDown { from { clip-path: inset(0 0 100% 0); opacity: .4; } to { clip-path: inset(0 0 0 0); opacity: 1; } }
.host p.reveal { animation: revealDown .32s ease-out; }
.apply-log { position: fixed; right: 18px; bottom: 70px; z-index: 50; display: flex; align-items: flex-start; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; font-size: 12.5px; box-shadow: 0 6px 20px rgba(0,0,0,.12); transition: opacity .6s; }
.apply-log.fade { opacity: 0; }
.al-ring { display: inline-grid; place-items: center; min-width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--gap); font-weight: 600; font-size: 12px; }
.al-lines { display: flex; flex-direction: column; gap: 2px; color: var(--mute); }

.outline { position: fixed; top: 64px; left: 50px; bottom: 112px; width: min(380px, calc(100vw - 70px)); z-index: 32; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.12); display: flex; flex-direction: column; }
.outline header { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.outline header b { flex: 1; }
.ol-list { overflow-y: auto; padding: 8px 12px; flex: 1; }
.ol-item { border-bottom: 1px solid var(--line); padding: 8px 0; }
.ol-item .ol-h { display: flex; align-items: center; gap: 6px; }
.ol-item .ol-h button.ol-go { flex: 1; text-align: left; border: 0; background: none; color: var(--ink); font: 600 13px var(--ui); padding: 0; cursor: pointer; }
.ol-item .ol-h .icon { width: 24px; height: 24px; border: 1px solid var(--line); border-radius: 50%; background: none; color: var(--mute); padding: 0; }
.ol-item p { margin: 4px 0 0; font-size: 13px; color: var(--ink); }
.ol-item ul { margin: 4px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--mute); }
.ol-item .n { color: var(--mute); font-size: 11.5px; font-weight: 400; }
.ev .acts { margin-top: 4px; }

.pts { display: grid; gap: 6px; max-height: 50vh; overflow: auto; margin-top: 8px; }
.pt { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line, rgba(127,127,127,.2)); }
.pt i { color: var(--mute); font-style: normal; }

#outlineBtn, #provBtn, #histBtn, #subtextBtn, #focusBtn { display: none !important; }
.more-grp .menu [data-lvl="1"] { display: block !important; }
.more-grp { position: relative; }
.tools-btn { white-space: nowrap; font-size: 18px; line-height: 1; min-width: 36px; padding: 4px 10px; }
.more-grp .menu [data-lvl] { display: none; }
.more-grp .menu [aria-checked="true"]::after { content: "✓"; float: right; color: var(--accent); }
.more-grp .menu button small { display: block; color: var(--mute); font-size: 11.5px; }
.menu .text-row { display: flex; align-items: center; gap: 2px; border-top: 1px solid var(--line); margin-top: 4px; padding: 4px 0 0 10px; }
.menu .text-row span { flex: 1; color: var(--mute); }
.menu .text-row button { width: auto; min-width: 44px; min-height: 44px; text-align: center; padding: 6px 8px; }
.menu .text-row button[aria-pressed="true"] { background: var(--panel-2); font-weight: 600; }
body.tb1 #subtextBtn, body.tb1 #focusBtn { display: none !important; }
body.tb1 .more-grp .menu [data-lvl="1"] { display: block; }
body.tb2 .review-btn .lbl-txt { display: none; }
body.tb3 #reviewBtn { display: none !important; }
body.tb4 #ownPill .op-bar { display: none; }
body.tb3 .more-grp .menu [data-lvl="3"] { display: block; }

#topbar:has(.menu:not([hidden])) > * { opacity: 1; }

#topbar:has(.menu:not([hidden])) { z-index: 47; }
@media (max-width: 720px) { .more-grp .menu [data-lvl="3"] { display: block; } }

.host p.first.short::first-letter { font-size: inherit; float: none; line-height: inherit; padding: 0; }

.chapter h2 { line-height: 1.15; margin-bottom: 1em; }
.chapter h2 .lbl { margin: .15em 0 .1em; }

.chapter h2 .ct.unnamed:empty:not(.adding) { display: none; }
.chapter h2 .ct.adding:empty::before { content: attr(data-ph); color: var(--mute); opacity: .6; }

.back-app { font: 13px var(--ui); color: var(--mute); text-decoration: none; padding: 6px 8px; border-radius: 8px; white-space: nowrap; }
.back-app:hover, .back-app:focus-visible { color: var(--ink); }

.fork-note { position: fixed; top: 66px; left: 50%; transform: translateX(-50%); z-index: 20; margin: 0; max-width: min(640px, calc(100% - 32px)); font: 12px/1.4 var(--ui); color: var(--mute); text-align: center; }
#book.screenplay { font-family: "Courier Prime", "Courier New", ui-monospace, monospace; }
#book.screenplay .host p { text-indent: 0 !important; text-align: left; hyphens: manual; margin: 0 0 1em; font-size: .85em; }
#book.screenplay .host p.first::first-letter { font-size: inherit; float: none; line-height: inherit; padding: 0; }
#book.screenplay .host p.sp-scene { text-transform: uppercase; font-weight: 700; margin-top: 1.6em; }
#book.screenplay .host p.sp-cue { margin: 1em 0 0 37%; text-transform: uppercase; }
#book.screenplay .host p.sp-dialogue { margin: 0 18% 1em 22%; }
#book.screenplay .host p.br { margin: 1.2em 0; }

.ol-tabs { display: flex; gap: 2px; padding: 6px 12px 0; flex-wrap: wrap; }
.ol-tabs button { border: 1px solid var(--line); background: none; border-radius: 999px; padding: 3px 10px; font: 12px var(--ui); color: var(--mute); }
.ol-tabs button[aria-selected="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.ol-act { margin: 12px 0 2px; font: 600 11px var(--ui); letter-spacing: .1em; text-transform: uppercase; color: var(--gap-ink); }
.ol-beats { margin: 4px 0 0; padding-left: 18px; font-size: 12.5px; }
.ol-addbeat input, .ol-name { width: 100%; border: 1px solid var(--line); background: none; border-radius: 6px; padding: 3px 6px; font: 12.5px var(--ui); color: var(--ink); margin-top: 4px; }
.ol-chs { display: grid; gap: 2px; margin-top: 6px; font: 12.5px var(--ui); }
.ol-ref { font-size: 12.5px; margin: 4px 0; }
.ref.stale button { text-decoration: line-through; }

@media (max-width: 720px) {

  #chapBtn, #subtextBtn, #focusBtn, #redoBtn, #undoMenuBtn, #themeBtn { display: none !important; }
  .more-grp .menu [data-lvl] { display: block; }
  .back-app { font-size: 0; padding: 6px; } .back-app::before { content: "←"; font-size: 18px; }
  #docTitle { max-width: 100%; }
  .meta { font-size: 10px; }

  #bar:not(:focus-within) .scope-row, #bar:not(:focus-within) .bar-hint, #bar:not(:focus-within) #barExpand, #bar:not(:focus-within) #noteBtn, #bar:not(:focus-within) .quick { display: none !important; }
  #bar:not(:focus-within) { padding: 9px 8px 9px 12px; min-height: 48px; }

  body.review #bar { display: block !important; }
  body.review #bar > .bar-hint, body.review #quick, body.review #barExpand { display: none !important; }
  body.review #wsTabConv { display: inline-flex; }
  #restoreDemo, #helpBtn, .fixture-note { display: none !important; }

  body.typing #bar, body.typing #ws, body.typing .sel-tools, body.typing .para-dot, body.typing #applyLog { display: none !important; }
  body.typing #canvas { padding-bottom: 60px; }
}

body.shape-hosted.review #bar, body:has(> .shape-demo-bar).review #bar { display: block !important; }
body.shape-hosted.review #bar > .bar-hint, body.shape-hosted.review #quick, body.shape-hosted.review #barExpand, body:has(> .shape-demo-bar).review #bar > .bar-hint, body:has(> .shape-demo-bar).review #quick, body:has(> .shape-demo-bar).review #barExpand { display: none !important; }
body.shape-hosted.review #wsTabConv, body:has(> .shape-demo-bar).review #wsTabConv { display: inline-flex; }
@media (max-width: 1100px) { body.shape-hosted #bar { bottom: calc(64px + env(safe-area-inset-bottom)); } }

@media (max-width: 720px) { .sel-tools.fixed { max-width: calc(100vw - 16px); overflow-x: auto; scrollbar-width: none; } .sel-tools.fixed button { flex: none; } }
.imp-adv { font-size: 12.5px; color: var(--mute); } .imp-adv summary { cursor: pointer; } .imp-adv[open] { display: grid; gap: 10px; }
body:has(#cbox:not([hidden])) .review-pill { display: none; }
@media (max-width: 720px) { body.typing.sel-on .sel-tools:not([hidden]) { display: flex !important; } }

::highlight(shape-fb) { background-color: color-mix(in srgb, var(--fb) 12%, transparent); }
::highlight(shape-fb-cur) { background-color: color-mix(in srgb, var(--fb) 24%, transparent); text-decoration: underline 2px var(--fb); text-underline-offset: 4px; }
.fb-btn b { color: var(--fb); font-weight: 600; margin-left: 2px; }
.fb-btn b:empty { display: none; }
.fb-layer { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.fb-badge { position: absolute; pointer-events: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--fb) 45%, transparent); background: var(--bg); color: var(--fb); font: 600 11px/18px var(--ui); text-align: center; }
.fb-badge:hover, .fb-badge.cur { background: var(--fb); color: var(--bg); border-color: var(--fb); }
.fb-nav { position: fixed; right: 16px; bottom: 120px; z-index: 33; display: flex; align-items: center; gap: 2px; background: var(--panel); border: 1px solid color-mix(in srgb, var(--fb) 40%, var(--line)); border-radius: 999px; padding: 3px; font: 12.5px var(--ui); box-shadow: 0 6px 18px rgba(0,0,0,.1); }
.fb-nav button { border: 0; background: none; border-radius: 999px; min-width: 34px; height: 34px; padding: 0 10px; font-size: 14px; color: var(--ink); }
.fb-nav .fb-n-lbl { font-size: 12.5px; padding: 0 10px 0 12px; color: var(--ink); }
.fb-nav span.fb-n-lbl { line-height: 34px; color: var(--mute); }
.fb-nav b { color: var(--fb); }
.fb-nav button:hover, .fb-nav button:focus-visible { background: color-mix(in srgb, var(--fb) 10%, transparent); }
.fb-panel .drawer-head { padding-left: 16px; }
.fb-step { display: flex; align-items: center; gap: 2px; font: 600 13px var(--ui); min-width: 0; }
.fb-step button { border: 0; background: none; color: var(--ink); border-radius: 999px; min-width: 32px; height: 32px; padding: 0 8px; font: 14px var(--ui); }
.fb-step .fb-n-lbl { font: 600 13px var(--ui); padding-left: 0; }
.fb-step b { color: var(--fb); }
.fb-step button:hover, .fb-step button:focus-visible { background: color-mix(in srgb, var(--fb) 10%, transparent); }
body.fb-open .fb-nav { display: none !important; }
.fb-head-acts { display: flex; align-items: center; gap: 2px; }
.fb-panel .drawer-body, .fb-peek { font: 13px/1.45 var(--ui); }
.fb-filt { display: grid; gap: 6px; margin-bottom: 10px; font-size: 12px; }
.fb-row { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.fb-lbl { color: var(--mute); width: 40px; flex: none; }
.fb-ppl { display: contents; }
.fb-ppl.many { display: flex; flex-wrap: wrap; gap: 4px; max-height: 120px; overflow-y: auto; flex-basis: 100%; padding-left: 44px; }
.fb-chip { border: 1px solid var(--line); background: none; color: var(--ink); border-radius: 999px; padding: 2px 9px; min-height: 26px; font-size: 12px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-chip i { font-style: normal; color: var(--mute); }
.fb-chip[aria-pressed="true"] { border-color: var(--fb); background: color-mix(in srgb, var(--fb) 12%, var(--panel)); }
.fb-find { flex: 1; min-width: 120px; border: 1px solid var(--line); background: none; color: var(--ink); border-radius: 999px; padding: 3px 10px; font: 12px var(--ui); }
.fb-sum { justify-content: space-between; color: var(--mute); }
.fb-done { display: inline-flex; align-items: center; gap: 4px; }
.fb-ai { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 10px 0; margin-bottom: 4px; }
.fb-ai-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.fb-ai-row .note { font-size: 11.5px; }
.fb-ai-out { margin-top: 10px; }
.fb-ai-src { font-size: 11.5px; color: var(--mute); margin: 0 0 6px; }
.fb-ai-err { margin: 8px 0 0; }
.fb-aq { border: 0; background: none; padding: 0; font: inherit; color: var(--fb); text-decoration: underline; text-underline-offset: 2px; text-align: left; cursor: pointer; }
.fb-sec { font: 600 11px var(--ui); letter-spacing: .06em; text-transform: uppercase; color: var(--mute); margin: 14px 0 6px; }
.fb-card { border: 1px solid var(--line); border-left: 3px solid color-mix(in srgb, var(--fb) 50%, transparent); border-radius: 0 10px 10px 0; padding: 7px 10px 8px; margin-bottom: 8px; background: var(--panel); cursor: pointer; }
.fb-card.fixed { cursor: default; }
.fb-card.cur { border-color: var(--fb); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fb) 40%, transparent); }
.fb-card.done { opacity: .62; }
.fb-where { font-size: 11px; color: var(--mute); }
.fb-q { display: block; border: 0; background: none; padding: 2px 0 0; margin: 0; text-align: left; font: italic 15px/1.35 var(--serif); color: var(--ink); cursor: pointer; }
.fb-q.gone { color: var(--mute); cursor: default; }
.fb-item { margin-top: 6px; }
.fb-item + .fb-item { border-top: 1px dashed var(--line); padding-top: 6px; }
.fb-meta { font-size: 11.5px; color: var(--mute); } .fb-meta b { color: var(--ink); font-weight: 600; }
.fb-item p { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.fb-item p.fb-fav { color: var(--fb); }
.fb-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; margin-top: 4px; }
.fb-acts .linkish { color: var(--mute); min-height: 24px; }
.fb-acts .linkish:hover { color: var(--ink); }
.fb-acts .fb-del:hover { color: var(--warn); }
.fb-sent { font-size: 12px; color: var(--mute); }
.fb-unv { color: var(--mute); font-weight: 400; }
.fb-v { font-size: 11px; color: var(--mute); overflow-wrap: anywhere; }
.fb-v.ok { color: var(--ok); }
.fb-ck { color: var(--ok); margin-right: 3px; font-weight: 600; }
.fb-hid { opacity: .5; } .fb-chip.fb-hid { border-style: dashed; }
.fb-favs { list-style: none; margin: 2px 0 0; padding: 0; }
.fb-favs li { padding: 3px 0 0; } .fb-favs li .fb-acts { margin-top: 0; }
.fb-togs { display: inline-flex; flex-wrap: wrap; gap: 2px 10px; }
.fb-peek { display: none; }
@media (max-width: 720px) {
  #fbBtn { display: none !important; }
  .fb-nav { bottom: auto !important; top: 68px; right: 8px; }
  .fb-nav button { min-width: 36px; height: 36px; }
  .fb-badge { min-width: 16px; height: 16px; padding: 0 3px; font-size: 10px; line-height: 14px; }
  .fb-peek:not([hidden]) { display: block; position: fixed; top: 114px; left: 8px; right: 8px; z-index: 34; max-height: 32vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 6px 10px 8px; box-shadow: 0 8px 24px rgba(0,0,0,.14); }
  .fb-peek .fb-card { margin: 0; border-top: 0; border-right: 0; border-bottom: 0; border-radius: 0; padding: 2px 0 2px 8px; }
  .fb-peek-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2px; }
  .fb-acts .linkish { min-height: 32px; }
  body.typing .fb-nav, body.typing .fb-peek, body.typing .fb-layer { display: none !important; }
}

.tour-card { position: fixed; z-index: 80; top: 64px; left: 50%; transform: translateX(-50%); width: min(400px, calc(100vw - 32px)); background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px 12px; box-shadow: 0 14px 40px rgba(0,0,0,.2); font-size: 14px; }
.tour-card.busy { pointer-events: none; } .tour-card.busy .tour-d::after { content: " · Shape is answering…"; color: var(--mute); }
.tour-card.low { top: auto; bottom: calc(150px + env(safe-area-inset-bottom)); }
.tour-n { margin: 0 0 2px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }
.tour-t { display: block; font-size: 16px; margin-bottom: 4px; }
.tour-d { margin: 0 0 12px; line-height: 1.45; color: var(--ink); }
.tour-acts { display: flex; gap: 8px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.tour-acts .quiet { margin-right: auto; }
.tour-acts .btn, .tour-acts .quiet { min-height: 40px; }
.tour-acts .btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.tour-ring { outline: 3px solid var(--accent, #c0830c) !important; outline-offset: 3px; border-radius: 10px; transition: outline-color .2s; }
.help-panel #tourStart { margin-bottom: 8px; }
@media (max-width: 600px) { .tour-card { top: 52px; padding: 10px 12px 8px; font-size: 13px; } .tour-d { margin-bottom: 8px; } .tour-t { font-size: 15px; } .tour-acts .btn, .tour-acts .quiet { min-height: 36px; } }

.sel-tools button small { display: block; font-size: 10.5px; line-height: 1.1; color: var(--mute); font-weight: 400; letter-spacing: .01em; }
.sel-tools button { line-height: 1.15; }

#mdlBody fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px 10px; margin: 10px 0 0; }
#mdlBody legend { font-size: 12px; font-weight: 600; padding: 0 4px; }
#mdlBody legend .note { font-weight: 400; }
#mdlBody .x-front .fld input { width: 100%; }
#mdlBody .x-inc { display: grid; gap: 2px; }

.t-reply.thinking { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: center; }
.t-reply.thinking > :not(.shape-orb) { grid-column: 2; }
.t-reply.thinking .shape-orb { grid-row: 1 / span 3; }
.shape-orb { position: relative; display: inline-block; width: 30px; height: 30px; border-radius: 50%; overflow: hidden; flex: none;
  background: radial-gradient(circle at 34% 30%, #fff6dc 0%, #f1cf7a 26%, #c0830c 62%, #5b3d0a 100%);
  box-shadow: 0 0 0 1px rgba(192,131,12,.25), 0 4px 18px rgba(192,131,12,.35); animation: orb-breathe 2.4s ease-in-out infinite; }
.shape-orb::before { content: ""; position: absolute; inset: -40%; background: conic-gradient(from 0deg, transparent 0 20%, rgba(255,246,220,.55) 30%, transparent 45% 70%, rgba(95,126,166,.35) 82%, transparent 92%);
  animation: orb-swirl 3.2s linear infinite; mix-blend-mode: soft-light; }
.shape-orb::after { content: ""; position: absolute; left: 22%; top: 16%; width: 30%; height: 22%; border-radius: 50%; background: rgba(255,255,255,.55); filter: blur(2px); }
@keyframes orb-swirl { to { transform: rotate(360deg); } }
@keyframes orb-breathe { 0%, 100% { transform: scale(.92); box-shadow: 0 0 0 1px rgba(192,131,12,.25), 0 3px 12px rgba(192,131,12,.25); } 50% { transform: scale(1); box-shadow: 0 0 0 1px rgba(192,131,12,.35), 0 6px 24px rgba(192,131,12,.45); } }
:root[data-theme="dark"] .shape-orb { box-shadow: 0 0 0 1px rgba(240,195,90,.3), 0 4px 22px rgba(240,195,90,.35); }
@media (prefers-reduced-motion: reduce) { .shape-orb, .shape-orb::before { animation: none; } }

@media (max-width: 600px) { .review-pill { border-radius: 999px; } .review-pill .rp-long { display: none; } }

.shape-orb { animation-duration: 4.8s !important; } .shape-orb::before, .shape-orb::after { animation-duration: 9s !important; }

body > .shape-demo-bar { position: fixed; inset: 0 0 auto 0; height: 28px; z-index: 31; display: flex; gap: 10px; align-items: center; justify-content: center; font: 12px var(--ui, system-ui); background: var(--panel-2, var(--panel)); color: var(--ink); border-bottom: 1px solid var(--line); }
body > .shape-demo-bar button { font: inherit; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--ink); padding: 2px 10px; cursor: pointer; }
body > .shape-demo-bar .demo-cta { font-weight: 600; color: var(--ink); text-underline-offset: 2px; white-space: nowrap; }
@media (max-width: 560px) { body > .shape-demo-bar .demo-more { display: none; } body > .shape-demo-bar { gap: 8px; font-size: 11.5px; } }
body:has(> .shape-demo-bar) #topbar, body:has(> .shape-demo-bar) #scroller { top: 28px; }
body:has(> .shape-demo-bar) .tour-card:not(.low) { top: 92px; }
body:has(> .shape-demo-bar) .legend { top: 96px; }
body:has(> .shape-demo-bar) #topbar > * { opacity: 1; }
body:has(> .shape-demo-bar) .pastePass, body:has(> .shape-demo-bar) #sendAllConv { display: none !important; }
@media (max-width: 720px) { body > .shape-demo-bar span { display: none; } body:has(> .shape-demo-bar) .tour-card:not(.low) { top: 80px; } }
.new-reply { left: auto; right: 14px; transform: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tour-card { box-shadow: 0 14px 40px rgba(0,0,0,.45); } }
:root[data-theme="dark"] .tour-card { box-shadow: 0 14px 40px rgba(0,0,0,.45); }

:root { accent-color: var(--ink); }
.ws:not(.closed) .ws-tabs { width: 100%; margin: 0; box-sizing: border-box; }
.ws:not(.closed) .ws-body { border-top-left-radius: 0; border-top-right-radius: 0; }
.toast { top: 72px; bottom: auto; }
.cbox textarea::placeholder, .fld input::placeholder, #input::placeholder { color: var(--mute); opacity: 1; }
.prop del + ins { margin-left: .25em; }
body.review .sub-bar { top: 108px; }
#docTitle { max-width: min(60vw, 44ch); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
#docTitle:focus { overflow: visible; }
.pop select { appearance: none; background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 4px 24px 4px 8px; font: 13px var(--ui, system-ui); }
body:has(#scroller)::after { content: ""; position: fixed; inset: auto 0 0 0; height: 130px; background: linear-gradient(transparent, var(--bg) 45%); pointer-events: none; z-index: 24; }
@media (max-width: 720px) {
  .host p { text-align: left; hyphens: manual; }
  .cq-foot .note { display: none; }
  .back-app, #meta, #undoBtn, .ws-tab, #wsToggle, #reviewExit, #fHelp { min-height: 40px; }
  .back-app { min-width: 40px; display: inline-flex; align-items: center; }
  .meta { font-size: 12px; }
  .toast { top: 64px; }
}
body:has(> .shape-demo-bar) .review-pill, body:has(> .shape-demo-bar) .sub-bar { top: 92px; }
body.review:has(> .shape-demo-bar) .sub-bar { top: 136px; }
.toast { top: 124px; }
body:has(> .shape-demo-bar) .toast { top: 152px; }
@media (max-width: 720px) {
  #legend { left: 8px; right: 8px; width: auto; max-width: none; bottom: 140px; top: auto; max-height: 48vh; overflow: auto; }
  body:has(> .shape-demo-bar) .tour-card:not(.low) { top: 100px; }
  .toast { top: 116px; }
}

.own-pill { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--ink); font: 12px var(--ui, system-ui); padding: 4px 10px; min-height: 28px; cursor: pointer; white-space: nowrap; }
.own-pill .op-bar { width: 64px; height: 4px; border-radius: 4px; background: var(--gap, #c0830c); overflow: hidden; }
.own-pill .op-bar i { display: block; height: 100%; background: var(--ink); border-radius: 4px; transition: width .4s ease; }
.own-pill .op-s { color: color-mix(in srgb, var(--gap, #c0830c) 75%, var(--ink)); }
@media (max-width: 899px) { .own-pill { display: none !important; } }
.catch-chip { border-color: var(--gap); color: var(--ink); }
.apply-all { margin: 12px 0 6px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.apply-all .aa-kicker { margin: 0 0 2px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }
.apply-all .aa-n { margin: 0 0 8px; font-size: 13.5px; color: var(--ink); }
.apply-all .btn.applying { background: linear-gradient(90deg, color-mix(in srgb, var(--gap) 80%, var(--ink)) var(--pct, 0%), var(--accent) var(--pct, 0%)); color: var(--on-accent); }
body.story-blank .chapter:first-of-type .write-line:empty::before { content: "What’s your story?"; font: 400 clamp(26px, 4vw, 40px)/1.2 var(--serif); font-style: normal; color: var(--ink); opacity: .9; }

body.guide-simple #rail, body.guide-simple .more-grp, body.guide-simple #ownPill, body.guide-simple #legend, body.guide-simple #catchUpChip, body.guide-simple #optChip, body.guide-simple .hosted-share-btn, body.guide-simple .gap, body.guide-simple .continue-btn, body.guide-simple .bar-hint { display: none !important; }
.guide-card { box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.guide-card[hidden] { display: none; }
.guide-count { margin: -6px 0 10px; font-size: 12.5px; color: var(--mute); }

.chapter .menu { z-index: 40; }
