:root { color-scheme:light; background:#f2f3f7; }
html { scrollbar-gutter:stable; }
body { margin:0; background:#f2f3f7; }
[hidden] { display:none !important; }
#catalog {
  --ink:#222638; --muted:#646d80; --accent:#6545db; --soft:#f0ebff;
  font:16px/1.45 system-ui,-apple-system,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;
  color:var(--ink); -webkit-text-size-adjust:100%;
}
#catalog, #catalog * { box-sizing:border-box; }
#catalog button,#catalog input { font:inherit; }
#catalog button,#catalog a { touch-action:manipulation; -webkit-tap-highlight-color:transparent; }
#catalog button { border:0; padding:0; background:none; cursor:pointer; color:inherit; }
#catalog a { color:inherit; text-decoration:none; }
#catalog :is(a,button,input):focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
.symbols,.sr { position:absolute; width:1px; height:1px; clip-path:inset(50%); overflow:hidden; }
.glyph { width:21px; height:21px; flex:none; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; pointer-events:none; }
#library { max-width:660px; margin:auto; padding: max(12px,env(safe-area-inset-top)) 12px calc(104px + env(safe-area-inset-bottom)); }
#files { overflow-anchor:none; display:grid; gap:10px; margin:0; padding:0; list-style:none; }
.record-head { position:relative; border-radius:inherit; }
.record { position:relative; min-width:0; border-radius:22px; background:white; }
#catalog .record .file-action {
  display:flex; width:100%; min-height:86px; align-items:center; gap:14px;
  padding:15px 47px 15px 16px; border-radius:inherit; text-align:start;
}
#catalog .file-action:active { background:#f5f3fc; }
.file-copy { display:flex; min-width:0; flex-direction:column; align-items:flex-start; gap:4px; }
.file-name { font-size:16px; line-height:1.4; font-weight:650; overflow-wrap:anywhere; }
.file-code,#detail-code { color:var(--muted); font-size:12px; font-variant-numeric:tabular-nums; letter-spacing:.025em; white-space:nowrap; }
.file-extra { font-size:12px; color:#626a7a; overflow-wrap:anywhere; }
.file-badge { font-size:11px; line-height:18px; padding:0 7px; border-radius:7px; color:#5f6371; background:#f0f1f5; }
#catalog .icon-btn { width:44px; height:44px; display:grid; place-items:center; border-radius:50%; color:#737b8e; }
.record .info { position:absolute; top:50%; right:4px; transform:translateY(-50%); }
.file-mark {
  flex:none; display:grid; place-items:center; width:44px; height:46px; border-radius:13px; background:var(--tile); color:var(--tone);
}
[data-tone="0"] { --tone:#694ac4; --tile:#eee8fd; --fold:#b5a3eb; }
[data-tone="1"] { --tone:#217478; --tile:#def3f1; --fold:#8bcac6; }
[data-tone="2"] { --tone:#995726; --tile:#f9ecdc; --fold:#e8b584; }
[data-tone="3"] { --tone:#376baa; --tile:#e5edfc; --fold:#a7bded; }
.file-mark .leaf {
  position:relative; display:grid; place-items:end center; width:26px; height:31px; padding-bottom:4px;
  background:var(--tone); color:white; border-radius:3px;
  clip-path:polygon(0 0,66% 0,100% 28%,100% 100%,0 100%);
  font:650 10px/1 system-ui,sans-serif; font-variant-numeric:tabular-nums;
}
.leaf::before { content:""; position:absolute; top:0; right:0; width:34%; height:29%; border-radius:0 0 0 2px; background:var(--fold); }
#files[data-layout="grid"] { grid-template-columns:repeat(auto-fill,minmax(min(100%,78px),1fr)); gap:6px; }
[data-layout="grid"] .record { border-radius:14px; }
[data-layout="grid"] .record-head { height:100%; }
#catalog [data-layout="grid"] .file-action {
  min-height:91px; height:100%; flex-direction:column; align-items:flex-start; justify-content:flex-start;
  gap:6px; padding:9px 8px; border-radius:14px;
}
[data-layout="grid"] .file-mark { width:27px; height:28px; border-radius:7px; }
[data-layout="grid"] .leaf { width:17px; height:21px; padding-bottom:3px; font-size:7px; }
[data-layout="grid"] .file-name { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; font-size:12px; line-height:1.35; }
[data-layout="grid"] .file-code { font-size:10px; letter-spacing:-.03em; white-space:nowrap; }
[data-layout="grid"] .file-copy { gap:2px; }
[data-layout="grid"] .file-extra,[data-layout="grid"] .file-badge { max-width:100%; font-size:10px; overflow-wrap:anywhere; }
#empty { min-height:45vh; display:grid; place-items:center; color:var(--muted); font-size:15px; }
.dock-shell {
  display:grid;
  position:fixed; z-index:5; left:50%; bottom:calc(12px + env(safe-area-inset-bottom) + var(--ime,0px));
  transform:translateX(-50%); width:min(calc(100% - 24px),370px); pointer-events:none;
}
#controls,.panel { pointer-events:auto; background:#fff; box-shadow:0 4px 18px #28234412,0 12px 42px #28234412; }
#controls { grid-area:2/1; width:max-content; max-width:100%; margin:0 auto; display:flex; align-items:center; gap:3px; padding:5px; border-radius:50px; }
#controls button { min-width:62px; max-width:114px; height:44px; padding:0 11px; display:flex; align-items:center; justify-content:center; gap:6px; border-radius:40px; color:#60687c; font-size:13px; font-weight:600; }
#controls button span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
#controls button.chosen { background:#6243d9; color:white; }
#controls button.applied:not(.chosen) { color:#5d3dcd; background:var(--soft); }
.panel { grid-area:1/1; align-self:end; margin:0 auto 9px; padding:7px; width:100%; border-radius:21px; }
.panel[inert] { opacity:0; pointer-events:none; }
#search-panel { display:flex; align-items:center; gap:9px; padding:4px 7px 4px 16px; color:var(--accent); }
#query { min-width:0; flex:1; height:46px; border:0; padding:0; background:transparent; color:var(--ink); }
#catalog #query:focus { outline:none; }
#query::-webkit-search-cancel-button { display:none; }
#filter-panel { overflow:auto; overscroll-behavior:contain; max-height:min(52vh,360px); }
#filter-panel button { width:100%; min-height:44px; padding:8px 12px; display:flex; align-items:center; justify-content:space-between; font-size:15px; border-radius:13px; text-align:left; }
#filter-panel button span { flex:1; }
#filter-panel button { gap:10px; }
#filter-panel button[aria-pressed="true"] { color:var(--tone,var(--ink)); background:var(--tile,#f1f2f5); }
#controls button[data-panel="filter"][data-tone] { color:var(--tone); background:var(--tile); }
#controls .view-switch { display:flex; align-items:center; padding-left:4px; margin-left:1px; position:relative; }
.view-switch::before { content:""; position:absolute; left:0; width:1px; height:20px; background:#e7e5ee; }
#controls [data-layout] { padding:0; min-width:44px; width:44px; }
#controls [data-layout][aria-pressed="true"] { color:white; background:#6243d9; }
#catalog .info[aria-expanded="true"] { color:var(--accent); background:var(--soft); }
.row-detail { overflow:hidden; }
.row-body { padding:0 16px 12px; }
.facts { margin:0; }
.facts div { display:grid; grid-template-columns:4em minmax(0,1fr); gap:12px; padding:8px 0; border-top:1px solid #efeff4; font-size:13px; }
.facts dt { color:var(--muted); }
.facts dd { margin:0; overflow-wrap:anywhere; }
html.detail-open { overflow:hidden; }
#detail { position:fixed; inset:0; margin:0; padding:16px; width:100%; max-width:none; height:100%; max-height:none; border:0; background:transparent; color:inherit; overflow:hidden; }
#detail[open] { display:grid; place-items:center; }
#detail::backdrop { background:transparent; }
.detail-shade { position:absolute; inset:0; background:rgba(24,22,36,.43); }
#detail.leaving .detail-shade { opacity:0; }
#detail.leaving .detail-card { opacity:0; transform:var(--return-to); }
.detail-card { position:relative; width:min(100%,340px); max-height:calc(100% - env(safe-area-inset-top) - env(safe-area-inset-bottom)); overflow-y:auto; overscroll-behavior:contain; padding:21px; border-radius:22px; background:white; box-shadow:0 16px 60px #17152528; }
#catalog #back { position:absolute; top:8px; right:8px; }
#file-name { margin:12px 0 2px; font-size:21px; line-height:1.35; overflow-wrap:anywhere; }
#fields { margin:16px 0 2px; }
#catalog #detail-open { display:grid; min-height:44px; margin-top:12px; place-items:center; background:var(--accent); color:white; border-radius:13px; font-size:14px; font-weight:600; }
@media (min-width:700px) { #library {padding-top:24px} #files[data-layout="grid"] {grid-template-columns:repeat(6,minmax(0,1fr));} }
@media (hover:hover) { #catalog .record:hover { box-shadow:0 3px 14px #2020390b; } #catalog .info:hover { background:#f3f2f9; color:var(--accent); } }
@media (prefers-reduced-motion:no-preference) {
  #controls button,.file-action,.info { transition:background-color 130ms,color 130ms; }
}
.reader {
  --muted:#6c727b;
  --line:#e2e5eb;
  --accent:#364560;
  font:16px/1.5 system-ui,"Microsoft YaHei",sans-serif;
  color:#232933;
}
.reader, .reader * {box-sizing:border-box}
.reader button, .reader select {
  border:0;
  padding:0;
  font:inherit;
  color:inherit;
  cursor:pointer;
  touch-action:manipulation;
  -webkit-tap-highlight-color:transparent;
}
.reader .icon-button {
  width:44px;
  height:44px;
  display:inline-grid;
  place-items:center;
  border-radius:50%;
  flex:none;
}
.reader .icon {
  width:22px;
  height:22px;
  stroke:currentColor;
  stroke-width:1.7;
  stroke-linecap:round;
  stroke-linejoin:round;
  fill:none;
}
.reader :focus-visible {outline:2px solid var(--accent);outline-offset:-2px}
.reader{position:fixed;inset:0;z-index:100;background:#f5f5f7;display:flex;flex-direction:column}
.reader-header{display:flex;align-items:center;gap:10px;flex:none;min-height:74px;padding:calc(10px + env(safe-area-inset-top)) 14px 10px;background:#fff;border-bottom:1px solid #eef0f6}
.reader-header>.icon-button{background:#eef0f4;color:#404855}
.reader-heading{flex:1;min-width:0;padding-right:12px}
.reader-heading h2{font-size:1rem;font-weight:600;line-height:1.4;margin:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.reader-heading p{font-size:.75rem;color:var(--muted);margin:3px 0 0;font-variant-numeric:tabular-nums}
.reader-scroll{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain;padding:14px 0 20px;-webkit-overflow-scrolling:touch;outline:none;overflow-anchor:none}
.reader-pages{margin:0 auto;min-height:100%}
.reader-page{margin:0 0 16px;position:relative}
.reader-page figcaption{padding:8px 0 0;text-align:center;font-size:.75rem;color:#5b6573;line-height:1.5}
.reader-footer{flex:none;background:#fff;border-top:1px solid #eef0f6;padding:8px 12px max(10px,env(safe-area-inset-bottom))}
.reader-toolbar{display:flex;align-items:center;justify-content:space-between;gap:8px;max-width:640px;margin:0 auto}
.reader-navigation,.reader-zoom{display:flex;align-items:center;justify-content:center;min-width:0}
.reader-navigation{flex:1}
.reader-zoom{flex:none;border-left:1px solid var(--line);padding-left:8px}
.reader-toolbar button{height:44px;background:transparent;color:#465263}
.reader-toolbar button:disabled{color:#c4c2cf}
.reader-toolbar button:not(:disabled):active{background:#eef0f4}
.reader-toolbar .icon{width:20px;height:20px}
#reader-page-select{appearance:none;-webkit-appearance:none;border:0;border-radius:14px;background:#eef0f4 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='%237b719b' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 7px center;text-align:center;text-align-last:center;height:40px;width:80px;min-width:60px;padding:0 19px 0 7px;font-size:.8125rem;font-variant-numeric:tabular-nums;color:#465263}
#reader-page-select:disabled{color:#a6a2b4}
#zoom-fit{min-width:52px;border-radius:12px;padding:0 4px;font-size:.8125rem;font-variant-numeric:tabular-nums}
.pdf-sheet{position:relative;background:#fff;overflow:hidden;box-shadow:0 3px 16px #1e1b4b06}
.pdf-sheet[aria-busy=true]::after{content:"Loading";position:absolute;left:0;right:0;top:40px;text-align:center;color:#9290a4;font-size:.875rem;pointer-events:none}
.pdf-sheet:has(canvas)::after{display:none}
.pdf-sheet canvas{display:block;width:100%;height:auto}
.reader-loading{padding:80px 12px;text-align:center;color:#858097;font-size:.875rem}
.reader-loading::before{content:"";display:block;width:24px;height:24px;border:2px solid #e4dff7;border-top-color:#7761d7;border-radius:50%;margin:0 auto 16px;animation:reader-spin .8s linear infinite}
.reader-error{padding:38px 20px;font-size:.875rem;color:#7a748b;text-align:center}
.reader-error button{display:block;margin:18px auto 0;min-height:44px;border-radius:14px;background:#fff;color:var(--accent);padding:0 24px}
.textLayer{position:absolute;inset:0;overflow:hidden;text-align:initial;line-height:1;letter-spacing:normal;word-spacing:normal;transform-origin:0 0;-webkit-text-size-adjust:none;text-size-adjust:none;--min-font-size:1;--min-font-size-inv:1;--text-scale-factor:calc(var(--total-scale-factor) * var(--min-font-size))}
.textLayer span,.textLayer br{color:transparent;position:absolute;white-space:pre;cursor:text;transform-origin:0 0;-webkit-user-select:text;user-select:text}
.textLayer>span,.textLayer .markedContent span{--font-height:0;font-size:calc(var(--text-scale-factor) * var(--font-height));--scale-x:1;--rotate:0deg;transform:rotate(var(--rotate)) scaleX(var(--scale-x)) scale(var(--min-font-size-inv))}
.textLayer .markedContent{display:contents}
.textLayer ::selection{background:#8b5cf638;color:transparent}
.is-leaving{pointer-events:none}
.reader-document{display:block;width:100%;height:100%;border:0;background:#525659}
.native-document .reader-scroll{display:flex;padding:0;overflow:hidden}
.native-document .reader-pages{flex:1;width:100%!important;min-height:0;height:100%;margin:0}
.native-document .reader-footer{display:none}

@keyframes reader-spin { to { transform:rotate(360deg) } }
@media (max-width:370px) {
  .reader-footer {padding-inline:4px}
  .reader-toolbar {gap:0}
  .reader-zoom {padding-left:2px}
  #reader-page-select {width:60px}
  #zoom-fit {min-width:44px}
}
@media (prefers-reduced-motion:reduce) {
  .reader-loading::before {animation:none}
}
