/* /connect/writing/ - Blog feed + Writing library/reader. Artist-zone palette (navy + sunset accents). Nav CSS stays inline per page. */
:root {
  --navy: #0d1526; --navy-2: #13203a; --card: #17253f; --card-2: #1c2c4a; --ink: #070b14;
  --cream: #f7ede1; --dim: #cbb9c9; --dim-2: #a794a6; --line: rgba(247, 237, 225, 0.12); --line-2: rgba(247, 237, 225, 0.22);
  --orange: #ff6b4a; --gold: #ffb84d; --pink: #ff4d94; --cyan: #3fe8e0; --green: #6fdc9b;
  --font: 'Outfit', Helvetica, Arial, sans-serif; --mono: 'Space Mono', 'Courier New', monospace;
  --serif: 'Spectral', Georgia, 'Times New Roman', serif; --book: 'Literata', Georgia, serif;
  --r: 14px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { scroll-padding-top: 140px; }
body { background: var(--navy); color: var(--cream); font-family: var(--font); line-height: 1.6; -webkit-font-smoothing: antialiased; min-height: 100vh; }
body::before { content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(120% 70% at 50% -10%, rgba(255, 107, 74, 0.16), rgba(255, 77, 148, 0.07) 30%, transparent 62%); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
img, video { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.cw-main { max-width: 1180px; margin: 0 auto; padding: calc(76px + 3.25rem) 2rem 5rem; }
.eyebrow { font-size: 12px; letter-spacing: .28em; text-transform: uppercase; color: #d4784a; margin-bottom: .9rem; font-family: var(--mono); }
.eyebrow.small { font-size: 11px; margin-bottom: .5rem; letter-spacing: .22em; }
.cw-head h1 { font-family: 'Righteous', cursive; font-weight: 400; font-size: clamp(2.4rem, 5.5vw, 3.8rem); letter-spacing: .01em; line-height: 1;
  text-shadow: 0 0 22px rgba(255, 107, 74, 0.35); }
.cw-tabs { display: inline-flex; gap: .35rem; margin: 1.6rem 0 2.4rem; padding: .3rem; background: rgba(7, 11, 20, 0.55); border: 1px solid var(--line); border-radius: 999px; }
.cw-tabs a { padding: .55rem 1.35rem; border-radius: 999px; font-weight: 600; font-size: 15px; color: var(--dim); transition: color .2s, background .2s; }
.cw-tabs a:hover { color: var(--cream); }
.cw-tabs a[aria-current="page"] { background: var(--cream); color: var(--navy); }
.lede { color: var(--dim); max-width: 60ch; line-height: 1.75; margin-bottom: 2rem; }
.cw-muted { color: var(--dim-2); }
.cw-empty { color: var(--dim); padding: 3rem 0; text-align: center; }
.cw-error { color: #ff9b8a; font-size: .9rem; margin-top: .5rem; }

/* buttons */
.cw-btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border: 1.5px solid var(--line-2); background: transparent; color: var(--cream);
  padding: .6rem 1.15rem; border-radius: 999px; font-weight: 600; font-size: 14px; line-height: 1.1; transition: background .2s, border-color .2s, color .2s; white-space: nowrap; }
.cw-btn:hover { border-color: var(--gold); color: var(--gold); }
.cw-btn.primary { background: var(--orange); border-color: var(--orange); color: var(--navy); }
.cw-btn.primary:hover { background: var(--gold); border-color: var(--gold); color: var(--navy); }
.cw-btn.danger { border-color: rgba(255, 107, 74, 0.5); color: #ff9b8a; }
.cw-btn.danger:hover { background: var(--orange); color: var(--navy); }
.cw-btn.ghost { border-color: transparent; }
.cw-btn.small { padding: .42rem .85rem; font-size: 13px; }
.cw-btn.tiny { padding: .28rem .6rem; font-size: 12px; border-width: 1px; }
.cw-btn:disabled { opacity: .55; cursor: default; }

/* ---------- prose (shared by posts, reader, editor) ---------- */
.cw-prose p { margin-bottom: 1.05em; }
.cw-prose h2 { font-size: 1.3em; font-weight: 700; margin: 1.6em 0 .6em; line-height: 1.25; color: var(--cream); }
.cw-prose blockquote { border-left: 3px solid var(--orange); padding: .1em 0 .1em 1.1em; margin: 0 0 1.1em; font-style: italic; color: var(--cream); }
.cw-prose blockquote p:last-child { margin-bottom: 0; }
.cw-prose strong { color: var(--cream); font-weight: 700; }
.cw-prose a { color: var(--gold); text-decoration: underline; text-underline-offset: 3px; }
.reader .r-body a { color: var(--racc); }
.scene-break { text-align: center; margin: 1.8em 0; color: var(--dim-2); letter-spacing: .8em; }
.scene-break::before { content: '\2042'; font-size: 1.15em; letter-spacing: 0; }
.cw-figure { margin: 1.4em 0; }
.cw-figure img, .cw-figure video { width: 100%; border-radius: 10px; background: var(--ink); }
.cw-figure figcaption { font-size: .82em; color: var(--dim-2); margin-top: .5em; text-align: center; }
sup.fn a { color: var(--gold); font-size: .75em; padding: 0 .1em; }
.cw-notes { margin-top: 2.5em; padding-top: 1.2em; border-top: 1px solid var(--line); font-size: .85em; color: var(--dim); }
.cw-notes h3 { font-family: var(--mono); font-size: 11px; letter-spacing: .25em; text-transform: uppercase; margin-bottom: .8em; color: var(--dim-2); }
.cw-notes ol { padding-left: 1.4em; }
.cw-notes li { margin-bottom: .5em; }
.cw-notes .back { color: var(--gold); }

/* ---------- blog feed ---------- */
.cw-main.narrow { max-width: 720px; }
.feed-wrap { max-width: 680px; }
.cw-head.center { text-align: center; }
.feed { display: flex; flex-direction: column; gap: 1rem; }
.post-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 1.25rem 1.35rem 1rem; cursor: pointer;
  transition: border-color .2s, transform .2s, background .2s; }
.post-card:hover { border-color: var(--line-2); background: var(--card-2); }
.post-card:active { transform: scale(.995); }
.post-by { display: flex; align-items: center; gap: .75rem; margin-bottom: .85rem; flex-wrap: wrap; }
.post-av { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255, 107, 74, 0.6); flex: none; }
.post-who { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; margin-right: auto; }
.post-name strong { font-weight: 700; }
.post-name span, .post-who time { font-size: .86rem; }
.post-cat { font-family: var(--mono); font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--gold); border: 1px solid rgba(255, 184, 77, 0.35); padding: .25rem .55rem; border-radius: 999px; }
.post-badge { font-family: var(--mono); font-size: 10px; letter-spacing: .15em; text-transform: uppercase; color: var(--navy); background: var(--cyan); padding: .22rem .5rem; border-radius: 999px; }
.post-badge.pin { background: var(--gold); }
.post-title { font-size: 1.22rem; line-height: 1.3; font-weight: 700; margin-bottom: .45rem; }
.post-preview { color: var(--dim); font-size: 1.02rem; line-height: 1.65; }
.post-preview > * { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 0; }
.post-media { margin: .9rem -1.35rem 0; }
.post-media img, .post-media video { border-radius: 0; max-height: 560px; object-fit: cover; }
.post-foot { display: flex; align-items: center; gap: 1rem; margin-top: .9rem; font-size: .86rem; }
.post-more { color: var(--gold); font-weight: 600; }
.post-share { margin-left: auto; background: none; border: 0; color: var(--dim-2); font-size: .86rem; padding: .25rem .4rem; border-radius: 6px; }
.post-share:hover { color: var(--cream); }
.post-owner { display: flex; gap: .5rem; margin-top: .8rem; padding-top: .8rem; border-top: 1px dashed var(--line); }
.post-composer { display: flex; align-items: center; gap: .9rem; width: 100%; text-align: left; margin-bottom: 1rem; padding: 1rem 1.2rem;
  background: rgba(7, 11, 20, 0.45); border: 1.5px dashed var(--line-2); border-radius: var(--r); color: var(--dim); font-size: 1.02rem; }
.post-composer:hover { border-color: var(--orange); color: var(--cream); }
#more { display: flex; margin: 1.5rem auto 0; }
.post-full { padding-bottom: 2rem; }
.post-back { display: inline-block; font-family: var(--mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); margin-bottom: 1.6rem; }
.post-back:hover { color: var(--gold); }
.post-full-title { font-size: clamp(1.8rem, 4vw, 2.6rem); line-height: 1.15; letter-spacing: -.015em; margin: .3rem 0 1.3rem; }
.post-body { font-size: 1.08rem; line-height: 1.8; color: var(--dim); }
.post-full .post-foot { border-top: 1px solid var(--line); padding-top: 1rem; margin-top: 2rem; }

/* ---------- works: layout + side menu ---------- */
.works-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 2.5rem; align-items: start; }
.works-layout > * { min-width: 0; }
.works-menu { position: sticky; top: calc(76px + 1.5rem); max-height: calc(100vh - 76px - 3rem); overflow: auto; padding-right: .25rem; }
.menu-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.menu-label { font-family: var(--mono); font-size: 11px; letter-spacing: .25em; text-transform: uppercase; color: var(--dim-2); }
.menu-list { display: flex; flex-direction: column; gap: 2px; border-left: 1px solid var(--line); }
.menu-item { display: grid; grid-template-columns: 10px 1fr; column-gap: .65rem; padding: .6rem .8rem .6rem .9rem; border-radius: 0 10px 10px 0; margin-left: -1px;
  border-left: 2px solid transparent; transition: background .2s, border-color .2s; }
.menu-item:hover { background: rgba(247, 237, 225, 0.05); }
.menu-item.active { border-left-color: var(--orange); background: rgba(255, 107, 74, 0.09); }
.menu-item small { grid-column: 2; font-size: .78rem; color: var(--dim-2); line-height: 1.3; }
.menu-item:first-child { grid-template-columns: 1fr; }
.menu-item:first-child small { grid-column: 1; }
.menu-title { font-weight: 600; font-size: .96rem; line-height: 1.3; }
.menu-draft { color: var(--cyan); font-style: normal; font-size: .75rem; font-weight: 500; }
.menu-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: .45rem; background: var(--gold); box-shadow: 0 0 8px currentColor; color: var(--gold); }
.menu-dot.complete { background: var(--green); color: var(--green); }
.menu-dot.hiatus { background: var(--dim-2); color: transparent; }

/* ---------- shelf ---------- */
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 2.2rem 1.6rem; }
.book { display: flex; flex-direction: column; gap: .85rem; }
.book:hover .thumb { transform: translateY(-4px) rotate(-.4deg); box-shadow: 0 22px 40px -18px rgba(0, 0, 0, .8), 0 0 0 1px var(--line-2); }
.book-title { font-size: 1.05rem; line-height: 1.3; font-weight: 700; }
.book-meta { font-size: .8rem; color: var(--gold); font-family: var(--mono); letter-spacing: .02em; margin-top: .15rem; }
.book-sum { font-size: .88rem; color: var(--dim); line-height: 1.5; margin-top: .35rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.book .post-badge { align-self: flex-start; margin-top: .4rem; display: inline-block; }

.thumb { aspect-ratio: 2 / 3; border-radius: 6px 10px 10px 6px; overflow: hidden; position: relative; background: #f4ecdf;
  box-shadow: 0 14px 30px -16px rgba(0, 0, 0, .8), 0 0 0 1px var(--line); transition: transform .3s, box-shadow .3s; container-type: inline-size; }
.thumb::after { content: ''; position: absolute; inset: 0 auto 0 0; width: 6%; background: linear-gradient(90deg, rgba(0, 0, 0, .18), transparent); pointer-events: none; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.firstpage { position: absolute; inset: 0; padding: 12cqw 11cqw 0 13cqw; color: #2a2118; font-family: var(--serif); display: flex; flex-direction: column; align-items: center; text-align: center;
  background: linear-gradient(180deg, #faf5ec, #f1e7d6); }
.fp-kind { font-family: var(--mono); font-size: 4.2cqw; letter-spacing: .3em; text-transform: uppercase; color: #a5582c; }
.fp-title { font-size: 10.5cqw; line-height: 1.12; font-weight: 600; margin-top: 5cqw; text-wrap: balance; }
.fp-by { font-size: 5cqw; font-style: italic; margin-top: 3cqw; color: #5d4c3c; }
.fp-fandom { font-size: 4cqw; color: #8b7763; margin-top: 1.5cqw; }
.fp-rule { width: 22cqw; height: 1px; background: #c9b79f; margin: 6cqw 0 5cqw; flex: none; }
.fp-text { font-size: 4.3cqw; line-height: 1.55; text-align: justify; hyphens: auto; color: #3d3226; overflow: hidden; flex: 1;
  -webkit-mask-image: linear-gradient(180deg, #000 45%, transparent 96%); mask-image: linear-gradient(180deg, #000 45%, transparent 96%); }
.fp-text p { text-indent: 1.4em; }
.fp-text p:first-child { text-indent: 0; }
.fp-text p:first-child::first-letter { font-size: 2.3em; float: left; line-height: .9; padding: .05em .08em 0 0; color: #a5582c; }

/* ---------- story page ---------- */
.story { display: grid; grid-template-columns: minmax(180px, 280px) minmax(0, 1fr); gap: 2.4rem; align-items: start; }
.story-title { font-size: clamp(1.9rem, 3.6vw, 2.8rem); line-height: 1.1; letter-spacing: -.015em; font-weight: 800; }
.story-by { color: var(--dim); font-style: italic; margin: .35rem 0 1rem; font-family: var(--serif); font-size: 1.1rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1.1rem; }
.chip { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; padding: .3rem .65rem; border-radius: 999px; border: 1px solid var(--line-2); color: var(--dim); }
.chip.in-progress { color: var(--gold); border-color: rgba(255, 184, 77, .45); }
.chip.complete { color: var(--green); border-color: rgba(111, 220, 155, .45); }
.chip.draft { color: var(--cyan); border-color: rgba(63, 232, 224, .45); }
.story-sum { color: var(--dim); line-height: 1.75; margin-bottom: .8rem; max-width: 62ch; }
.story-stats { font-family: var(--mono); font-size: 12px; color: var(--dim-2); margin: 1rem 0 1.3rem; }
.story-acts { display: flex; flex-wrap: wrap; gap: .6rem; }
.story-also { margin-top: 1.2rem; font-size: .92rem; }
.story-also a { color: var(--gold); font-weight: 600; }
.story-also a:hover { text-decoration: underline; }
.toc { margin-top: 3rem; }
.toc-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .9rem; }
.toc-head h3 { font-family: var(--mono); font-size: 12px; letter-spacing: .25em; text-transform: uppercase; color: var(--dim-2); margin-right: auto; }
.toc-list { list-style: none; border-top: 1px solid var(--line); }
.toc-row { border-bottom: 1px solid var(--line); }
.toc-row.unpub .toc-link { opacity: .6; }
.toc-link { display: grid; grid-template-columns: 2.6rem minmax(0, 1fr) auto auto; gap: 1rem; align-items: baseline; padding: .95rem .5rem; border-radius: 8px; transition: background .2s; }
.toc-link:hover { background: rgba(247, 237, 225, .04); }
.toc-link.here .toc-t::after { content: '  \2022 reading'; color: var(--orange); font-size: .78rem; font-weight: 500; }
.toc-n { font-family: var(--mono); font-size: 12px; color: var(--orange); }
.toc-t { font-weight: 600; }
.toc-d, .toc-w { font-family: var(--mono); font-size: 12px; color: var(--dim-2); white-space: nowrap; }
.toc-owner { display: flex; flex-wrap: wrap; gap: .35rem; padding: 0 .5rem .8rem 3.6rem; }

/* ---------- reader ---------- */
body.reading::before { display: none; }
.reader { --rsize: 20px; --rbg: var(--navy); --rink: #ebe2d6; --rdim: var(--dim-2); --racc: var(--gold); --rline: var(--line);
  min-height: 100vh; background: var(--rbg); color: var(--rink); padding-top: 76px; }
.reader[data-theme="paper"] { --rbg: #f7f3ea; --rink: #24201a; --rdim: #7d7264; --racc: #b5501f; --rline: rgba(36, 32, 26, .14); }
.reader[data-theme="sepia"] { --rbg: #f1e5cf; --rink: #3b2e1f; --rdim: #85705a; --racc: #9f4a1c; --rline: rgba(59, 46, 31, .16); }
body.reading-light { background: var(--rbg-body, #f7f3ea); }
.r-bar { position: sticky; top: 76px; z-index: 30; display: flex; align-items: center; gap: 1rem; padding: .7rem 2rem; background: color-mix(in srgb, var(--rbg) 90%, transparent);
  backdrop-filter: blur(14px); border-bottom: 1px solid var(--rline); font-size: .92rem; }
.r-bar a, .r-bar button { color: var(--rink); }
#r-back { font-family: var(--mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--rdim); white-space: nowrap; }
#r-back:hover { color: var(--racc); }
#r-work { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
#r-where { color: var(--rdim); font-family: var(--mono); font-size: 12px; white-space: nowrap; margin-right: auto; }
.r-tool { background: none; border: 1px solid var(--rline); border-radius: 999px; padding: .4rem .9rem; font-weight: 600; font-size: 13px; }
.r-tool:hover, .r-tool[aria-expanded="true"] { border-color: var(--racc); color: var(--racc) !important; }
.r-progress { position: sticky; top: calc(76px + 52px); height: 2px; z-index: 29; }
#r-progress { display: block; height: 100%; background: linear-gradient(90deg, var(--orange), var(--pink)); transform-origin: 0 50%; transform: scaleX(0); }
.r-drawer { position: fixed; right: 1.25rem; top: calc(76px + 64px); z-index: 40; width: min(340px, calc(100vw - 2.5rem)); max-height: calc(100vh - 76px - 90px); overflow: auto;
  background: var(--rbg); color: var(--rink); border: 1px solid var(--rline); border-radius: var(--r); padding: 1.1rem; box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .6); }
.r-drawer h3 { font-family: var(--mono); font-size: 11px; letter-spacing: .25em; text-transform: uppercase; color: var(--rdim); margin-bottom: .6rem; }
.r-toc-item { display: flex; gap: .8rem; padding: .55rem .5rem; border-radius: 8px; font-size: .95rem; }
.r-toc-item:hover { background: color-mix(in srgb, var(--rink) 6%, transparent); }
.r-toc-item.active { color: var(--racc); font-weight: 700; }
.r-toc-item .toc-n { color: var(--rdim); }
.aa-group { margin-bottom: 1rem; }
.aa-label { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--rdim); margin-bottom: .45rem; }
.aa-row { display: flex; gap: .4rem; align-items: center; }
.aa-opt { flex: 1; background: none; border: 1px solid var(--rline); color: var(--rink); border-radius: 8px; padding: .5rem; font-size: 14px; font-weight: 600; }
.aa-opt.on { border-color: var(--racc); color: var(--racc); }
.aa-opt[data-font="spectral"] { font-family: var(--serif); } .aa-opt[data-font="literata"] { font-family: var(--book); }
.aa-val { min-width: 3.5rem; text-align: center; font-family: var(--mono); font-size: 12px; color: var(--rdim); }

.r-article { max-width: 38em; margin: 0 auto; padding: 3.5rem 1.5rem 6rem; font-size: var(--rsize); font-family: var(--serif); }
.reader[data-font="literata"] .r-article { font-family: var(--book); }
.reader[data-font="outfit"] .r-article { font-family: var(--font); }
.r-head { text-align: center; margin-bottom: 2.6em; }
.r-num { font-family: var(--mono); font-size: 12px; letter-spacing: .3em; text-transform: uppercase; color: var(--racc); margin-bottom: .8em; }
.r-title { font-size: 1.9em; line-height: 1.15; font-weight: 600; text-wrap: balance; }
.r-head::after { content: '\2042'; display: block; margin-top: .9em; color: var(--rdim); }
.r-body { line-height: 1.75; }
.r-body p { margin: 0; text-indent: 1.6em; hyphens: auto; }
.r-body p:first-child, .r-body .scene-break + p, .r-body h2 + p, .r-body blockquote + p, .r-body figure + p { text-indent: 0; }
.reader[data-drop="1"] .r-body > p:first-child::first-letter { float: left; font-size: 3.4em; line-height: .85; padding: .06em .1em 0 0; color: var(--racc); font-weight: 600; }
.r-body h2 { font-size: 1.15em; margin: 1.8em 0 .8em; text-align: center; }
.r-body blockquote { border-left: 2px solid var(--racc); padding-left: 1em; margin: 1em 0; font-style: italic; }
.r-body blockquote p { text-indent: 0; margin-bottom: .6em; }
.r-body .scene-break { color: var(--rdim); margin: 1.6em 0; }
.r-body sup.fn a { color: var(--racc); }
.reader .cw-notes { color: var(--rdim); border-color: var(--rline); font-family: var(--font); font-size: .78em; }
.reader .cw-notes .back { color: var(--racc); }
.r-note { margin-top: 3em; padding: 1.1em 1.3em; border: 1px dashed var(--rline); border-radius: 12px; font-family: var(--font); font-size: .82em; color: var(--rdim); }
.r-note b { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; margin-bottom: .5em; color: var(--racc); }
.r-note p + p { margin-top: .6em; }
.r-nav { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3.5em; padding-top: 1.6em; border-top: 1px solid var(--rline); font-family: var(--font); }
.reader .cw-btn { color: var(--rink); border-color: var(--rline); font-size: 15px; white-space: normal; text-align: center; }
.reader .cw-btn.primary { background: var(--racc); border-color: var(--racc); color: var(--rbg); }
.r-end { font-style: italic; color: var(--rdim); align-self: center; }
.r-article > .cw-btn.small { margin-top: 1.5rem; }

/* ---------- owner bar, toast, modal ---------- */
.cw-ownerbar { position: fixed; left: 50%; bottom: 1.1rem; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: .5rem; padding: .45rem .5rem .45rem 1rem;
  background: rgba(7, 11, 20, .92); border: 1px solid var(--line-2); border-radius: 999px; backdrop-filter: blur(12px); box-shadow: 0 16px 40px -14px #000; }
.cw-ownerbar-label { white-space: nowrap; font-family: var(--mono); font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--cyan); margin-right: .25rem; }
body.editing .cw-ownerbar, body.reading .cw-ownerbar { display: none; }
.cw-toast { position: fixed; left: 50%; bottom: 5rem; transform: translateX(-50%); z-index: 1000; background: var(--cream); color: var(--navy); padding: .7rem 1.2rem; border-radius: 999px;
  font-weight: 600; font-size: .92rem; box-shadow: 0 12px 30px -10px #000; max-width: calc(100vw - 2rem); text-align: center; }
.cw-modal { margin: auto; width: min(520px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); background: var(--navy-2); color: var(--cream); border: 1px solid var(--line-2); border-radius: 18px; padding: 1.5rem; }
.cw-modal.wide { width: min(860px, calc(100vw - 2rem)); }
.cw-modal::backdrop { background: rgba(7, 11, 20, .7); backdrop-filter: blur(3px); }
.cw-modal h2 { font-size: 1.25rem; margin-bottom: 1rem; }
.cw-modal p { margin-bottom: .6rem; }
.cw-modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; margin-top: 1.3rem; }
.cw-field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .9rem; }
.cw-field > span { font-family: var(--mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--dim-2); }
.cw-field small { font-size: .78rem; }
.cw-field input, .cw-field textarea, .cw-field select, .ch-bar input, .ch-bar select, .ch-note textarea {
  width: 100%; background: rgba(7, 11, 20, .55); color: var(--cream); border: 1px solid var(--line-2); border-radius: 10px; padding: .65rem .8rem; font: inherit; font-size: 15px; }
.cw-field textarea, .ch-note textarea { resize: vertical; line-height: 1.5; }
.cw-field input:focus, .cw-field textarea:focus, .cw-field select:focus, .ch-bar input:focus { outline: none; border-color: var(--gold); }
.cw-check { display: flex; align-items: center; gap: .45rem; font-size: .92rem; color: var(--dim); margin-bottom: .55rem; cursor: pointer; }
.cw-check input { accent-color: var(--orange); width: 1rem; height: 1rem; }
.cw-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; align-items: end; }
.cw-imgrow { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.cw-imgrow img { height: 72px; width: auto; border-radius: 6px; }
.cw-compose .ed-area { min-height: 220px; max-height: 50vh; }
.cw-split { max-height: 60vh; overflow: auto; }
.cw-split-row { display: grid; grid-template-columns: auto 1fr; gap: .8rem; align-items: start; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.cw-split-row input[type="checkbox"] { margin-top: .8rem; accent-color: var(--orange); width: 1rem; height: 1rem; }
.cw-split-row input:not([type]) { width: 100%; background: rgba(7, 11, 20, .55); color: var(--cream); border: 1px solid var(--line-2); border-radius: 8px; padding: .45rem .65rem; font: inherit; }
.cw-split-row small { display: block; margin-top: .3rem; font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- editor ---------- */
.ed { border: 1px solid var(--line-2); border-radius: 12px; background: rgba(7, 11, 20, .45); margin-bottom: .9rem; }
.ed-bar { display: flex; flex-wrap: wrap; gap: .25rem; padding: .45rem; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; background: var(--navy-2); border-radius: 12px 12px 0 0; }
.ed-tool { min-width: 2.1rem; height: 2.1rem; padding: 0 .55rem; border: 1px solid transparent; background: none; border-radius: 8px; color: var(--dim); font-size: 15px; font-weight: 600; }
.ed-tool:hover { background: rgba(247, 237, 225, .07); color: var(--cream); }
.ed-tool.b { font-weight: 800; } .ed-tool.i { font-style: italic; font-family: var(--serif); } .ed-tool.h { font-family: var(--serif); }
.ed-tool.fn, .ed-tool.ln { font-family: var(--mono); font-size: 12px; }
.ed-tool.ed-import { margin-left: auto; border-color: var(--line-2); font-size: 13px; color: var(--cream); }
.ed-tool.ed-import:hover { border-color: var(--gold); color: var(--gold); }
.ed-area { min-height: 320px; padding: 1.2rem 1.4rem; outline: none; font-family: var(--serif); font-size: 1.12rem; line-height: 1.75; color: var(--cream); overflow-wrap: anywhere; }
.ed-area.empty::before { content: attr(data-placeholder); color: var(--dim-2); position: absolute; pointer-events: none; font-style: italic; }
.ed-area hr { border: 0; margin: 1.6em 0; text-align: center; height: 1.2em; }
.ed-area hr::after { content: '\2042'; color: var(--dim-2); }
.ed-area h2 { font-family: var(--font); }
.ed-media { margin: 1em 0; padding: .4rem; border: 1px dashed var(--line-2); border-radius: 10px; cursor: pointer; }
.ed-media img, .ed-media video { max-height: 340px; margin: 0 auto; border-radius: 6px; }
.ed-media figcaption { font-size: .8em; text-align: center; color: var(--dim-2); margin-top: .3em; }
.ed-media figcaption:empty { display: none; }
.fn-chip { display: inline-block; color: var(--navy); background: var(--gold); border-radius: 4px; padding: 0 .3em; font-size: .7em; font-family: var(--mono); cursor: pointer; user-select: none; }
.ed-status { padding: .4rem .9rem; font-family: var(--mono); font-size: 11px; color: var(--dim-2); border-top: 1px solid var(--line); text-align: right; }
.ed-restore { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .6rem .9rem; background: rgba(63, 232, 224, .08); border-bottom: 1px solid var(--line); font-size: .88rem; color: var(--cyan); }
.ed-restore span { margin-right: auto; }

.ch-editor { position: fixed; inset: 0; z-index: 80; background: var(--navy); overflow: auto; display: flex; flex-direction: column; }
.ch-bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: .6rem; padding: .7rem 1.25rem; background: rgba(13, 21, 38, .96); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px); }
.ch-work { font-family: var(--mono); font-size: 12px; color: var(--dim-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 18ch; }
.ch-bar input.ch-title { flex: 1; min-width: 8rem; font-weight: 600; }
.ch-bar select { width: auto; }
.ch-page { width: 100%; max-width: 860px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
.ch-page .ed-bar { top: 61px; }
.ch-page .ed-area { min-height: 60vh; font-size: 1.18rem; padding: 2rem 2.4rem; }
.ch-note summary { cursor: pointer; color: var(--dim); font-size: .92rem; padding: .4rem 0; }
.ch-note textarea { margin-top: .5rem; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .works-layout { grid-template-columns: 1fr; gap: 1.5rem; }
  .works-menu { position: static; max-height: none; overflow: visible; }
  .menu-list { flex-direction: row; overflow-x: auto; border-left: 0; gap: .5rem; padding-bottom: .4rem; scrollbar-width: none; }
  .menu-item, .menu-item:first-child { display: block; flex: none; border: 1px solid var(--line); border-radius: 999px; padding: .5rem .95rem; margin: 0; white-space: nowrap; }
  .menu-item.active { border-color: var(--orange); }
  .menu-item small, .menu-dot { display: none; }
  .story { grid-template-columns: minmax(0, 1fr); }
  .story .thumb.big { max-width: 220px; }
}
@media (max-width: 768px) {
  .cw-main { padding: calc(64px + 2.5rem) 1rem 5rem; }
  .cw-tabs { margin: 1.2rem 0 1.6rem; }
  .post-card { padding: 1.05rem 1rem .9rem; border-radius: 12px; }
  .post-media { margin: .9rem -1rem 0; }
  .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.6rem 1rem; }
  .toc-link { grid-template-columns: 2.2rem minmax(0, 1fr) auto; gap: .6rem; }
  .toc-w { display: none; }
  .toc-owner { padding-left: 2.8rem; }
  .reader { padding-top: 64px; }
  .r-bar { top: 64px; padding: .6rem 1rem; gap: .6rem; }
  .r-progress { top: calc(64px + 50px); }
  #r-where { display: none; }
  #r-work { margin-right: auto; }
  .r-drawer { right: .75rem; left: .75rem; width: auto; top: calc(64px + 60px); }
  .r-article { padding: 2.5rem 1.15rem 5rem; }
  .cw-grid2 { grid-template-columns: 1fr; }
  .ch-bar { flex-wrap: wrap; padding: .6rem .75rem; }
  .ch-work { display: none; }
  .ch-bar input.ch-title { order: 5; flex-basis: 100%; }
  .ch-page { padding: 1rem .5rem 4rem; }
  .ch-page .ed-bar { top: 108px; }
  .ch-page .ed-area { padding: 1.2rem 1rem; }
  .cw-ownerbar { bottom: .75rem; }
}
@media (pointer: coarse) { .ed-tool { min-width: 2.5rem; height: 2.5rem; } }
