/* Adapted visual tokens and controls from Top-Conf Figure Gallery (MIT).
   Copyright (c) 2026 Top-Conf Figure Gallery contributors. See NOTICE.md. */
:root{--bg:#f6f7fb;--surface:#fff;--ink:#141a2a;--muted:#7b8290;--line:#e6e9f2;--accent:#4f46e5;--radius:14px;--shadow:0 1px 3px rgba(28,35,51,.05)}
*{box-sizing:border-box}html{scrollbar-gutter:stable}body{margin:0;font:14px/1.5 "Inter","PingFang SC","Microsoft YaHei","Segoe UI",system-ui,sans-serif;background:var(--bg);color:var(--ink);-webkit-font-smoothing:antialiased}button,input,select{font:inherit;color:inherit}button,summary,select{cursor:pointer}button{border:1px solid var(--line);border-radius:7px;background:white;padding:6px 10px}button:hover{border-color:#b9addd}button:disabled{opacity:.45;cursor:default}a{color:var(--accent);text-decoration:none}a:hover{text-decoration:underline}[hidden]{display:none!important}:focus-visible{outline:2px solid #aaa0ed;outline-offset:3px}
.hero{background:white;border-bottom:1px solid var(--line)}.hero-inner{max-width:1320px;margin:auto;padding:10px 28px;display:flex;align-items:center;justify-content:space-between;gap:12px}.brand{display:flex;align-items:center;gap:9px;min-width:0}.brand img{flex:none}.brand h1{font-size:17px;letter-spacing:.2px;font-weight:800;margin:0}.brand>span{font-size:11px;color:var(--muted)}.soft-button{font-size:12px;font-weight:600;background:#f7f5ff;color:#5141a8;border-color:#d9d4eb}.soft-button:hover{background:#eee9ff}
.stickbar{position:sticky;top:0;z-index:40;background:white;border-bottom:1px solid var(--line);box-shadow:0 4px 18px -14px rgba(28,35,51,.35)}.stickbar-inner{max-width:1320px;margin:auto;padding:8px 28px}.search-row{display:flex;align-items:center;gap:14px}.search-box{flex:1;min-width:0;display:flex;align-items:center;gap:8px;background:#f8f9fb;border:1px solid #edf0f5;border-radius:10px;padding:0 11px;color:#737d91}.search-box svg{flex:none}.search-box:focus-within{border-color:#aaa0ed;box-shadow:0 0 0 3px #4f46e51a}.search-box input{width:100%;min-width:0;border:0;outline:0;background:transparent;padding:8px 0;font-size:13px}.result-count{font-size:12px;font-weight:500;white-space:nowrap;color:var(--muted)}
.filter-row{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-top:6px}.filter-field{display:flex;align-items:center;gap:6px;min-width:0;font-size:12px;color:var(--muted)}.view-controls{display:flex;align-items:center;gap:12px;margin-left:auto;flex-wrap:wrap;font-size:12px}.filter-menu{position:relative}.filter-menu summary,.filter-field select{list-style:none;appearance:none;font-size:12px;font-weight:600;color:#42396c;line-height:1.5;min-height:32px;border:1px solid #d2cbea;border-radius:9px;padding:6px 26px 6px 10px;background:#f7f5ff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='m3 4.5 3 3 3-3' fill='none' stroke='%237468a5' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 8px center;white-space:nowrap;max-width:165px;overflow:hidden;text-overflow:ellipsis}.filter-menu summary::-webkit-details-marker{display:none}.filter-menu[open] summary,.filter-menu summary:hover,.filter-field select:hover{border-color:#a99bd7;background-color:#efebff}.filter-popover{position:absolute;top:calc(100% + 6px);left:0;min-width:220px;padding:8px;background:white;color:var(--ink);border:1px solid #d8d0ed;border-radius:11px;box-shadow:0 8px 24px #1c23331f;z-index:50}.topic-menu .filter-popover{left:auto;right:0;min-width:260px}.choices{display:grid;gap:3px;max-height:300px;overflow-y:auto}.choice{display:flex;align-items:center;gap:7px;padding:7px 8px;border-radius:6px;font-size:12px;cursor:pointer}.choice:hover{background:#f6f3ff}.choice.selected{background:#eee9ff;color:#5141a8}.choice.unavailable{opacity:.4;cursor:default}.choice input{width:13px;height:13px;margin:0;accent-color:var(--accent)}.option-count{margin-left:auto;color:var(--muted);font-size:11px}.filter-popover>button{display:block;width:100%;margin-top:6px;border:0;border-top:1px solid var(--line);border-radius:0;font-size:11px;color:var(--muted)}.text-button{font-size:12px;border:0;padding:5px 0;background:transparent;color:var(--muted)}
.active-filters{display:flex;align-items:center;flex-wrap:wrap;gap:6px;margin-top:7px}.active-group{display:flex;align-items:center;flex-wrap:wrap;gap:4px;border:1px solid #ebe7f5;border-radius:6px;padding:2px 5px;background:#fcfbff}.active-group-label{font-size:10px;color:var(--muted)}.filter-chip{border:0;padding:2px 5px;border-radius:4px;font-size:10px;background:#f0edff;color:#66599a}#sync{font-size:11px;color:var(--muted)}#sync:not(:empty){margin-top:6px}
main{max-width:1320px;margin:auto;padding:16px 28px 0;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px;align-items:start}article{position:relative;min-width:0;border:1px solid var(--line);border-radius:var(--radius);overflow:hidden;background:white;box-shadow:var(--shadow)}article:hover{border-color:#b9c0d1;box-shadow:0 2px 5px #1c233312,0 5px 12px #1c23331a}.image-link{position:relative;display:flex;align-items:center;justify-content:center;height:255px;padding:7px;background:#eef1f7;cursor:zoom-in;overflow:hidden}.image-link img{display:block;width:100%;height:100%;object-fit:contain}.image-link.is-loaded{background:white}.image-loading,.image-error{position:absolute;font-size:12px;color:#98a0b3}.content{padding:12px 14px 14px}small{display:flex;align-items:center;gap:7px;font-size:11px;color:var(--muted)}.badge{margin-left:auto;font-size:10px;font-weight:400;padding:1px 6px;background:#edf0ff;color:#6375ac;border-radius:4px}.badge.oral{background:#f7f2e7;color:#8a7444}h2{font-size:15px;font-weight:650;line-height:1.4;margin:8px 0;overflow-wrap:anywhere}article h2 mjx-container{max-width:100%;overflow-x:auto;overflow-y:hidden;padding:2px 0}.card-authors{font-size:11px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin:7px 0}.paper-tags{display:flex;gap:4px;flex-wrap:wrap;margin:8px 0}.paper-tags button{font-size:10px;padding:2px 5px;color:#77718b;background:#f7f6fb;border:0}.content nav{display:flex;flex-wrap:wrap;gap:8px 12px;font-size:11px;margin-top:10px}.content nav a{color:var(--accent);font-weight:400;text-decoration:underline;text-underline-offset:3px;text-decoration-color:#b4acf3}.content nav a:hover{text-decoration-color:currentColor}.rotate-poster{position:absolute;right:8px;top:8px;z-index:2;width:30px;height:30px;padding:0;font-size:21px;line-height:1;background:#ffffffeb;opacity:0;transition:opacity .15s}article:hover .rotate-poster,article:focus-within .rotate-poster{opacity:1}
main.masonry{display:block;column-count:var(--gallery-columns,2);column-gap:18px}.masonry article{break-inside:avoid;page-break-inside:avoid;margin-bottom:18px}.masonry.images-only .content{display:none}
.topic-separator{width:100%;border:0;border-top:1px solid var(--line);margin:7px 0}
.masonry.text-only .image-link,.masonry.text-only .rotate-poster{display:none}.masonry .image-link{display:flex;height:auto;min-height:100px;padding:0;font-size:0}.masonry .image-link img{width:100%;height:auto}.more{text-align:center;padding:24px 16px 36px}.empty-state{text-align:center;padding:50px 20px;color:var(--muted)}
dialog{width:min(1400px,calc(100vw - 112px));height:95vh;height:95dvh;max-height:95vh;max-height:95dvh;border:1px solid var(--line);border-radius:16px;padding:0;background:white;color:var(--ink);box-shadow:0 20px 80px #0003}dialog::backdrop{background:#101424a8}body:has(dialog[open]){overflow:hidden}#viewer-stage{position:relative;display:grid;place-items:center;flex:1;min-height:0;background:#f8f9fb;overflow:hidden}#viewer-image{display:block;object-fit:contain;max-width:none}#viewer-status{position:absolute;font-size:12px;color:var(--muted)}.viewer-meta{flex:none;max-height:24vh;overflow:auto;padding:10px 20px 12px}.viewer-meta p{margin:0;color:var(--muted);font-size:12px}.viewer-meta h2{font-size:17px}.viewer-meta nav{display:flex;gap:18px;font-size:12px;margin-top:10px}
@media(max-width:1000px){.view-controls{margin-left:0}main{grid-template-columns:repeat(2,minmax(0,1fr))}.brand>span{display:none}}
@media(max-width:600px){.hero-inner{padding:10px 16px}.brand h1{font-size:15px}.brand img{width:24px;height:24px}.stickbar-inner{padding:8px 16px}.filter-row{gap:7px}.filter-row>.filter-field{flex-direction:column;align-items:stretch;flex:1;gap:3px;min-width:50px}.filter-menu summary{padding-left:7px;padding-right:20px;font-size:11px;max-width:110px}.filter-popover{min-width:200px;max-width:calc(100vw - 32px)}.filter-row>.filter-field:nth-child(n+3) .filter-popover{left:auto;right:0}.topic-menu .filter-popover{min-width:245px}.view-controls{width:100%;gap:12px}.view-controls .filter-field{font-size:11px}.view-controls select{font-size:11px}.result-count{font-size:11px}.search-row{gap:8px}.search-box{padding:0 8px}.search-box input{font-size:12px}.search-box svg{display:none}.active-filters{max-height:90px;overflow:auto}main{padding:14px 16px 0;grid-template-columns:1fr}main.masonry{column-count:1}.image-link{height:245px}.viewer-meta{padding:12px}dialog{width:calc(100vw - 80px)}.viewer-meta h2{font-size:15px}}
@media(hover:none){.rotate-poster{opacity:.8}}

.single-menu .filter-popover{min-width:150px;left:auto;right:0}
.single-menu .choice{width:100%;border:0;background:transparent;text-align:left;color:var(--ink);font-weight:400;line-height:1.5}
.single-menu .choice:hover{background:#f6f3ff}
.single-menu .choice.selected{background:#eee9ff;color:#5141a8}
.single-menu .choice.selected::after{content:"✓";margin-left:auto;color:var(--accent)}
@media(max-width:600px){.view-controls .filter-menu summary{font-size:11px;padding-left:7px;padding-right:20px}}

.filter-menu:not([open]) .filter-popover{display:none}


dialog[open]{display:flex;flex-direction:column;overflow:visible}
#viewer-stage>button,#viewer>button{position:absolute;z-index:2;width:36px;height:42px;padding:7px;border-color:#d8d0ed;background:#ffffffe6;box-shadow:0 2px 8px #18213a1a;color:#5141a8}
#viewer-stage>button:hover,#viewer>button:hover{background:white;border-color:#a99bd7}
#viewer-stage>button:disabled,#viewer>button:disabled{opacity:.3}
#viewer-stage>button svg,#viewer>button svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.8}
#viewer-prev{left:-48px;top:50%;transform:translateY(-50%)}
#viewer-next{right:-48px;top:50%;transform:translateY(-50%)}
#viewer-stage>#viewer-rotate{right:52px;top:10px;width:34px;height:34px;padding:0;font-size:22px;line-height:1}
.viewer-meta nav a{text-decoration:underline;text-underline-offset:3px}
@media(max-width:600px){#viewer-prev{left:-36px}#viewer-next{right:-36px}.viewer-meta{max-height:24dvh}#viewer-stage>button,#viewer>button{width:30px;height:38px;padding:4px}}

#viewer-stage{border-radius:15px 15px 0 0}.viewer-meta{border-radius:0 0 15px 15px}
#viewer-stage>#viewer-close{right:10px;top:10px;width:34px;height:34px;padding:0;font-size:24px;line-height:1}

#cards:not(.text-only) article:not(.poster-ready){display:none}

#load-sentinel{display:flex;align-items:center;justify-content:center;gap:8px;color:var(--muted);font-size:12px}
#load-sentinel.is-loading::before{content:"";width:14px;height:14px;border:2px solid var(--line);border-top-color:var(--accent);border-radius:50%;animation:poster-loading .8s linear infinite}
@keyframes poster-loading{to{transform:rotate(360deg)}}
@media(prefers-reduced-motion:reduce){#load-sentinel.is-loading::before{animation:none}}

.header-actions{display:flex;align-items:center;gap:8px;flex:none}html[lang=en] .topic-menu .filter-popover{width:min(380px,calc(100vw - 32px))}

.repository-link{display:inline-flex;align-items:center;white-space:nowrap;border:1px solid #d9d4eb;border-radius:7px;padding:6px 10px}.repository-link:hover{text-decoration:none;border-color:#b9addd}
@media(max-width:600px){.hero-inner{flex-wrap:wrap}.header-actions{margin-left:auto}}
