.reference-images{margin:14px 0 16px;min-width:0}
.reference-images-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px;font-size:14px;color:#68707b}
.reference-images-heading button{border:0;background:none;padding:8px 0 8px 12px;font:inherit;color:var(--green,#e34561);cursor:pointer;min-height:44px}
.reference-images-heading button:disabled{opacity:.5;cursor:wait}
.reference-image-strip{display:flex;gap:8px;overflow-x:auto;overscroll-behavior-x:contain;padding:0 0 5px;scroll-snap-type:x proximity;scrollbar-width:none}
.reference-image-strip::-webkit-scrollbar{display:none}
.reference-image-strip button{flex:0 0 96px;width:96px;height:128px;border:0;border-radius:10px;overflow:hidden;padding:0;background:#edf0f3;cursor:pointer;scroll-snap-align:start;color:#68707b}
.reference-image-strip img{display:block;width:100%;height:100%;object-fit:cover}
.reference-image-strip img[hidden]{display:none}
.reference-card .reference-images-message{font-size:13px;line-height:1.6;color:#976323;display:block;margin:8px 0 0}
body.reference-gallery-open{overflow:hidden}
.reference-gallery{position:fixed;inset:0;z-index:200;background:#111;color:#fff;display:flex;flex-direction:column;height:100dvh;padding:max(12px,env(safe-area-inset-top)) 0 max(12px,env(safe-area-inset-bottom));box-sizing:border-box}
.reference-gallery.hide{display:none}
.reference-gallery-heading{display:grid;grid-template-columns:80px 1fr 80px;align-items:center;text-align:center;padding:0 12px;flex:0 0 52px}
.reference-gallery button{background:transparent;color:#fff;border:0;padding:12px;font:inherit;min-height:44px;cursor:pointer;border-radius:8px}
.reference-gallery button:focus-visible{outline:2px solid #fff;outline-offset:-3px}
.reference-gallery button:disabled{opacity:.3;cursor:default}
.reference-gallery-track{display:flex;flex:1;min-height:0;width:100%;overflow-x:auto;overflow-y:hidden;scroll-snap-type:x mandatory;overscroll-behavior-x:contain;scrollbar-width:none}
.reference-gallery-track::-webkit-scrollbar{display:none}
.reference-gallery-slide{flex:0 0 100%;width:100%;height:100%;display:flex;align-items:center;justify-content:center;scroll-snap-align:center;scroll-snap-stop:always;position:relative}
.reference-gallery-slide img{width:100%;height:100%;object-fit:contain}
.reference-gallery-slide img[hidden]{display:none}
.reference-gallery-slide p{padding:24px;color:#ccc;font-size:15px;line-height:1.8;text-align:center}
.reference-gallery-actions{display:flex;justify-content:space-between;padding:8px 16px 0;flex:0 0 60px}
@media(min-width:700px){.reference-image-strip button{flex-basis:112px;width:112px;height:150px}.reference-gallery-slide img{max-width:1100px}}

/* 同行封面流：每篇笔记一张卡片，正文和管理操作放在详情页。 */
#referenceList.reference-feed{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;align-items:start;min-width:0}
.reference-feed-column{display:flex;flex-direction:column;gap:10px;min-width:0}
.reference-feed-card{display:block;width:100%;padding:0;text-align:left;background:#fff;border:0;border-radius:8px;overflow:hidden;cursor:pointer;color:#25262b;font:inherit;box-shadow:0 1px 2px #20252b04}
.reference-feed-card:focus-visible{outline:3px solid #e4486088;outline-offset:2px}
.reference-feed-cover{position:relative;overflow:hidden;background:#eceef0;width:100%}
.reference-feed-cover>img{display:block;width:100%;height:100%;object-fit:cover;position:absolute;inset:0}
.reference-cover-count{position:absolute;right:7px;top:7px;padding:2px 7px;background:#25252d70;color:white;border-radius:10px;font-size:11px;line-height:1.7}
.reference-cover-placeholder{display:flex;align-items:center;justify-content:center;flex-direction:column;gap:10px;width:100%;height:100%;position:absolute;inset:0;background:#eff0f2;color:#a3a7af;font-size:13px;font-weight:400}
.reference-cover-placeholder svg{display:block;width:40px;height:40px;fill:none;stroke:#b7bbc3;stroke-width:1.4;stroke-linecap:round;stroke-linejoin:round}
.reference-feed-caption{padding:10px 10px 12px}
.reference-feed-caption h3{font-size:16px;font-weight:600;line-height:1.5;margin:0 0 9px;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;overflow-wrap:anywhere}
.reference-feed-product{font-size:12px;color:#85858e;line-height:1.5;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.reference-feed-state{font-size:12px;color:#aa7a49;display:block;margin-top:7px}
body.reference-detail-open{overflow:hidden}
.reference-detail{position:fixed;inset:0;z-index:65;background:#fff;color:#25262b;display:flex;flex-direction:column;height:100dvh;padding-top:env(safe-area-inset-top,0px);font-family:-apple-system,BlinkMacSystemFont,"PingFang SC",sans-serif}
.reference-detail.hide{display:none}
.reference-detail-header{display:grid;grid-template-columns:96px 1fr 96px;align-items:center;text-align:center;flex:0 0 54px;padding:0 12px;border-bottom:1px solid #f1f2f4;background:white;font-size:16px;font-weight:600}
.reference-detail-header button{min-height:44px;padding:8px 4px;border:0;background:none;font-size:15px;color:#3a3c42;cursor:pointer;font-weight:400;text-align:left}
.reference-detail-header .reference-detail-edit{text-align:right;color:#df405c}
.reference-detail-scroll{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;padding-bottom:calc(24px + env(safe-area-inset-bottom,0px));scrollbar-width:thin}
.reference-detail-hero{background:#f5f5f5}
.reference-detail-track{display:flex;width:100%;height:min(64dvh,580px);overflow-x:auto;overflow-y:hidden;scroll-snap-type:x mandatory;scrollbar-width:none;overscroll-behavior-x:contain}
.reference-detail-track::-webkit-scrollbar{display:none}
.reference-detail-slide{display:block;flex:0 0 100%;width:100%;height:100%;padding:0;border:0;background:none;scroll-snap-align:center;scroll-snap-stop:always;position:relative;cursor:zoom-in}
.reference-detail-slide img{width:100%;height:100%;display:block;object-fit:contain}
.reference-detail-image-nav{display:flex;align-items:center;justify-content:center;gap:24px;background:#fff;color:#9b9da5;font-size:12px;min-height:42px}
.reference-detail-image-nav button{width:44px;min-height:40px;font-size:23px;color:#8c9099;background:none;border:0;cursor:pointer}
.reference-detail-image-nav button:disabled{opacity:.25;cursor:default}
.reference-detail-empty{height:230px;position:relative}
.reference-detail-article{max-width:720px;margin:0 auto;padding:12px 20px 24px}
.reference-detail-article h2{font-size:21px;line-height:1.55;margin:0 0 18px;overflow-wrap:anywhere;font-weight:650}
.reference-detail-body{font-size:17px;line-height:1.9;white-space:pre-wrap;overflow-wrap:anywhere;color:#36383e;margin:0 0 20px}
.reference-detail-topics{font-size:16px;color:#537b99;line-height:1.9;overflow-wrap:anywhere;margin:0 0 22px}
.reference-detail-product{font-size:13px;color:#90939d;padding:14px 0;border-top:1px solid #f0f1f3;margin:0}
.reference-detail-error{font-size:13px;line-height:1.7;white-space:pre-line;color:#ad7138;margin:8px 0}
.reference-detail-tools{display:flex;gap:10px;flex-wrap:wrap;border-top:1px solid #f0f1f3;padding-top:12px;margin-top:6px;align-items:center}
.reference-detail-tools button,.reference-detail-tools a{font:inherit;font-size:13px;line-height:1.5;padding:10px 12px;min-height:44px;background:#f5f6f8;border:0;border-radius:10px;text-decoration:none;color:#6a6d77;cursor:pointer;box-sizing:border-box;display:inline-flex;align-items:center}
.reference-detail-tools button:disabled{opacity:.5}
.reference-author{display:flex;align-items:center;gap:7px;min-width:0;font-size:12px;line-height:1.5;color:#82858e;min-height:24px}
.reference-avatar,.reference-avatar-fallback{width:22px;height:22px;flex:0 0 22px;border-radius:50%;object-fit:cover}
.reference-avatar-fallback{display:grid;place-items:center;background:#f0eaeb;color:#a89197;font-size:11px}
.reference-avatar[hidden],.reference-avatar-fallback[hidden]{display:none}
.reference-author:has(.reference-avatar) .reference-avatar-fallback{display:none}
.reference-author-name{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
.reference-detail-article>.reference-author{margin:0 0 18px;font-size:14px;gap:10px;color:#62666e}
.reference-detail-article .reference-avatar,.reference-detail-article .reference-avatar-fallback{width:32px;height:32px;flex-basis:32px}
img.reference-inline-emoji{display:inline-block;width:1.25em;height:1.25em;vertical-align:-.24em;object-fit:contain;margin:0 .04em}
@media(max-width:640px){#appMain #tab-references #referenceList{margin:0 -10px}#appMain #tab-references .section-caption{display:none}#appMain #tab-references>.product-switch{margin-bottom:14px}.reference-feed-caption{padding:9px 9px 11px}.reference-feed-caption h3{font-size:15px}.reference-feed-product{font-size:12px}}
@media(min-width:900px){.reference-detail{left:50%;width:min(780px,100vw);transform:translateX(-50%);box-shadow:0 0 0 100vmax #171b2166}.reference-feed-caption h3{font-size:17px}}

/* 阅读页连续布局，安全区只保留系统所需空间。 */
.reference-detail{box-sizing:border-box}
.reference-detail-header{display:flex;gap:8px;padding:0 12px;flex:0 0 52px;border:0;text-align:left}
.reference-detail-header>button{flex:0 0 32px;font-size:36px;line-height:1;padding:0;min-height:44px}
.reference-header-author{min-width:0;flex:1}
.reference-header-author .reference-author{font-size:16px;color:#25262b;gap:10px}
.reference-header-author .reference-avatar,.reference-header-author .reference-avatar-fallback{width:32px;height:32px;flex-basis:32px}
.reference-detail-scroll{padding:0;scrollbar-width:none}
.reference-detail-scroll::-webkit-scrollbar{display:none}
.reference-detail-hero{position:relative;background:#fff}
.reference-detail-track{height:auto;aspect-ratio:3/4}
.reference-detail-slide{height:100%}
.reference-detail-slide img{object-fit:contain}
.reference-detail-counter{position:absolute;right:12px;top:12px;background:#0006;color:#fff;border-radius:16px;padding:3px 9px;font-size:13px;line-height:1.5;pointer-events:none}
.reference-detail-dots{display:flex;align-items:center;justify-content:center;height:24px;gap:0;background:#fff}
.reference-detail-dots button{position:relative;width:18px;height:24px;padding:0;border:0;background:none;cursor:pointer}
.reference-detail-dots button:after{content:'';display:block;width:5px;height:5px;margin:auto;border-radius:50%;background:#d5d5d5}
.reference-detail-dots button.on:after{background:#ff3156}
.reference-detail-dots[hidden],.reference-detail-counter[hidden]{display:none}
.reference-detail-article{box-sizing:border-box;width:100%;max-width:none;padding:0 16px 20px;margin:0}
.reference-detail-article h2{font-size:19px;line-height:1.5;margin:0 0 10px;font-weight:650}
.reference-detail-body{font-size:16px;line-height:1.8;margin:0 0 12px}
.reference-detail-topics{font-size:15px;line-height:1.8;margin:0}
.reference-detail-footer{display:flex;align-items:center;gap:12px;padding:9px 16px calc(9px + env(safe-area-inset-bottom,0px));border-top:1px solid #f1f1f1;background:#fff;flex-shrink:0}
.reference-copy-body{flex:0 0 auto;border:0;background:#f5f5f5;border-radius:22px;padding:11px 15px;color:#696b70;font:inherit;font-size:14px;cursor:pointer;min-height:44px}
.reference-open-original{flex:1;min-height:44px;display:flex;align-items:center;justify-content:center;border-radius:22px;background:#ff3156;color:#fff;text-decoration:none;font-size:15px;font-weight:550}
@media(prefers-reduced-motion:reduce){.reference-detail-track{scroll-behavior:auto}}

.reference-products-button{flex:0 0 auto;min-height:44px;padding:10px 8px;background:#f5f5f5;border:0;border-radius:22px;color:#50535b;font:inherit;font-size:14px;cursor:pointer}
.reference-detail-footer{gap:8px;padding-left:12px;padding-right:12px}
.reference-copy-body{padding-left:10px;padding-right:10px}
.reference-open-original{font-size:14px;white-space:nowrap}
.reference-product-dialog{width:min(440px,calc(100% - 28px));max-height:calc(100dvh - 100px);padding:20px;border:0;border-radius:20px;color:#25262b;background:white;box-sizing:border-box}
.reference-product-dialog::backdrop{background:#0006}
.reference-product-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}
.reference-product-heading h2{margin:0;font-size:20px}.reference-product-heading button{border:0;background:none;color:#df405c;font:inherit;min-height:44px;padding:8px}
.reference-product-dialog p{font-size:14px;line-height:1.6;color:#777;margin:8px 0 12px}
.reference-product-options{max-height:45dvh;overflow:auto;overscroll-behavior:contain}
.reference-product-options label{display:flex;align-items:center;gap:12px;padding:14px 0;border-bottom:1px solid #eee;cursor:pointer}
.reference-product-options input{width:20px;height:20px;accent-color:#e44860;flex-shrink:0}
.reference-product-dialog .reference-product-error{color:#b14e37}
.reference-product-save{width:100%;padding:12px;background:#e44860;color:white;border:0;border-radius:12px;font:inherit;min-height:46px}.reference-product-save:disabled{opacity:.5}
