/* 文笺 — quiet monochrome chrome; colour lives only in the file "spines". */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --raised: #ffffff;
  --sunken: #eceef2;
  --hover: #eef0f3;
  --ink: #1d232c;
  --body: #3a424d;
  --muted: #6b7380;
  --faint: #9aa1ab;
  --line: #e2e5ea;
  --line-strong: #cfd4db;
  --primary: #1d232c;
  --on-primary: #ffffff;
  --focus: #2f5bd3;
  --danger: #c0392f;
  --danger-soft: #fdecea;
  --ok: #1f8a5b;
  --reader-bg: #e9ebee;
  --page-shadow: 0 1px 2px rgba(20, 26, 36, .08), 0 6px 24px rgba(20, 26, 36, .08);
  --pop-shadow: 0 2px 6px rgba(20, 26, 36, .06), 0 16px 40px rgba(20, 26, 36, .14);
  --mark: #fde68a;
  --mark-active: #f59e0b;

  --c-doc: #2f5bd3;
  --c-pdf: #c8423a;
  --c-sheet: #1f8a5b;
  --c-slide: #d9772b;
  --c-image: #8a5cc2;
  --c-media: #0e8a9a;
  --c-text: #5a6472;
  --c-archive: #9a7440;
  --c-other: #8c939e;

  --font: system-ui, -apple-system, "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "SimSun", Georgia, serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, "Noto Sans Mono CJK SC", monospace;
  --radius: 10px;
  --radius-sm: 7px;
  --top-h: 60px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #15181d; --surface: #1c2027; --raised: #232831; --sunken: #111418; --hover: #252a33;
  --ink: #e8ebef; --body: #c9ced6; --muted: #959daa; --faint: #6c7480; --line: #2b313a; --line-strong: #3a414c;
  --primary: #e8ebef; --on-primary: #15181d; --focus: #7d9bf2; --danger: #ef6b5f; --danger-soft: #3a1f1e; --ok: #4cc08a;
  --reader-bg: #0f1215; --page-shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 28px rgba(0,0,0,.35); --pop-shadow: 0 2px 6px rgba(0,0,0,.3), 0 18px 44px rgba(0,0,0,.5);
  --mark: #7a5c10; --mark-active: #d08a0b;
  --c-doc: #5b80ec; --c-pdf: #e0635a; --c-sheet: #3aa977; --c-slide: #e8924d; --c-image: #a581d8; --c-media: #2fa9b8; --c-text: #7e8896; --c-archive: #b8925c; --c-other: #7d8591;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15181d; --surface: #1c2027; --raised: #232831; --sunken: #111418; --hover: #252a33;
    --ink: #e8ebef; --body: #c9ced6; --muted: #959daa; --faint: #6c7480; --line: #2b313a; --line-strong: #3a414c;
    --primary: #e8ebef; --on-primary: #15181d; --focus: #7d9bf2; --danger: #ef6b5f; --danger-soft: #3a1f1e; --ok: #4cc08a;
    --reader-bg: #0f1215; --page-shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 28px rgba(0,0,0,.35); --pop-shadow: 0 2px 6px rgba(0,0,0,.3), 0 18px 44px rgba(0,0,0,.5);
    --mark: #7a5c10; --mark-active: #d08a0b;
    --c-doc: #5b80ec; --c-pdf: #e0635a; --c-sheet: #3aa977; --c-slide: #e8924d; --c-image: #a581d8; --c-media: #2fa9b8; --c-text: #7e8896; --c-archive: #b8925c; --c-other: #7d8591;
    color-scheme: dark;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--bg); color: var(--body); font: 15px/1.6 var(--font); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; overflow-wrap: anywhere; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { color: var(--ink); font-weight: 600; line-height: 1.3; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; opacity: .5; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
[data-icon] { display: inline-flex; align-items: center; justify-content: center; }
code { font-family: var(--mono); font-size: .9em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.noscript { padding: 24px; text-align: center; }
::selection { background: color-mix(in srgb, var(--focus) 28%, transparent); }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font-weight: 550; font-size: 14px; white-space: nowrap; transition: background-color .12s, border-color .12s; }
.btn:hover:not(:disabled) { background: var(--hover); }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover:not(:disabled) { background: color-mix(in srgb, var(--primary) 86%, var(--bg)); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 88%, #000); }
.btn-block { width: 100%; min-height: 46px; font-size: 15px; }
.btn-small { min-height: 32px; padding: 0 12px; font-size: 13px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: none; padding: 0; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); transition: background-color .12s, color .12s; }
.icon-btn:hover:not(:disabled), .icon-btn[aria-expanded="true"], .icon-btn[aria-pressed="true"] { background: var(--hover); color: var(--ink); }
.icon-btn.is-active { color: var(--ink); background: var(--sunken); }
.ghost-icon { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border: 0; background: none; color: var(--faint); border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; }
.ghost-icon:hover { color: var(--ink); }
input:where(:not([type="checkbox"]):not([type="range"])), select { min-height: 44px; width: 100%; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font-size: 16px; }
input:focus, select:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 22%, transparent); }
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { color: var(--ink); font-size: 14px; font-weight: 550; }
.field-help { color: var(--muted); font-size: 13px; line-height: 1.5; }
.field-help code { background: var(--sunken); padding: 1px 5px; border-radius: 4px; overflow-wrap: anywhere; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 46px; }
.form-error { margin: 0 0 14px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger); font-size: 14px; }
.inline-error { margin: 0 0 16px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger); }
.select { position: relative; display: inline-flex; }
.select select { min-height: 36px; width: auto; padding: 0 30px 0 10px; font-size: 14px; border-color: transparent; background: transparent; color: var(--body); -webkit-appearance: none; appearance: none; cursor: pointer; }
.select select:hover { background: var(--hover); }
.select::after { content: ""; position: absolute; right: 12px; top: 50%; width: 6px; height: 6px; margin-top: -5px; border-right: 1.6px solid var(--muted); border-bottom: 1.6px solid var(--muted); transform: rotate(45deg); pointer-events: none; }
.segmented { display: inline-flex; padding: 2px; border-radius: 9px; background: var(--sunken); }
.segmented .icon-btn { width: 34px; height: 32px; border-radius: 7px; }
.segmented .icon-btn[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.segmented .icon-btn svg { width: 18px; height: 18px; }

/* ---------- spines: the one coloured element ---------- */
.spine { --c: var(--c-other); position: relative; display: inline-flex; align-items: flex-end; justify-content: center; flex: none; width: 34px; height: 44px; padding-bottom: 5px; border-radius: 4px 6px 6px 4px; background: var(--c); color: #fff; box-shadow: inset 3px 0 0 rgba(0,0,0,.14), inset 0 -1px 0 rgba(0,0,0,.08); }
.spine::before { content: ""; position: absolute; left: 7px; right: 5px; top: 7px; height: 2px; border-radius: 1px; background: rgba(255,255,255,.55); }
.spine-label { font: 700 9px/1 var(--font); letter-spacing: .02em; max-width: 100%; padding: 0 2px; overflow: hidden; white-space: nowrap; }
.spine-doc { --c: var(--c-doc); } .spine-pdf { --c: var(--c-pdf); } .spine-sheet { --c: var(--c-sheet); } .spine-slide { --c: var(--c-slide); }
.spine-image { --c: var(--c-image); } .spine-media { --c: var(--c-media); } .spine-text { --c: var(--c-text); } .spine-archive { --c: var(--c-archive); } .spine-other { --c: var(--c-other); }
.spine-sm { width: 26px; height: 34px; padding-bottom: 4px; } .spine-sm::before { top: 5px; left: 6px; right: 4px; } .spine-sm .spine-label { font-size: 7.5px; }

/* ---------- boot ---------- */
.boot { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; }
.boot-shelf { display: flex; align-items: flex-end; gap: 5px; height: 40px; }
.boot-shelf i { width: 10px; border-radius: 2px; animation: rise 1s ease-in-out infinite alternate; }
.boot-shelf i:nth-child(1) { height: 30px; background: var(--c-doc); }
.boot-shelf i:nth-child(2) { height: 38px; background: var(--c-pdf); animation-delay: .15s; }
.boot-shelf i:nth-child(3) { height: 26px; background: var(--c-sheet); animation-delay: .3s; }
@keyframes rise { to { transform: translateY(-6px); } }

/* ---------- auth ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 40px; padding: calc(32px + var(--safe-t)) 20px calc(32px + var(--safe-b)); }
.auth-card { width: 100%; max-width: 380px; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); font-weight: 650; font-size: 18px; letter-spacing: .06em; }
.brand-mark { width: 26px; height: 26px; }
.auth-brand { margin-bottom: 36px; }
.auth h1 { font-size: 26px; letter-spacing: .01em; }
.auth-description { margin: 8px 0 28px; color: var(--muted); }
.auth-shelf { display: flex; align-items: flex-end; gap: 6px; opacity: .9; }
.auth-shelf .spine:nth-child(odd) { height: 52px; }
.auth-shelf .spine:nth-child(3n) { height: 40px; }
.auth-shelf .spine:nth-child(5) { transform: rotate(-6deg); transform-origin: bottom left; margin-left: 4px; }

/* ---------- app shell ---------- */
.app { min-height: 100vh; min-height: 100dvh; }
.topbar { --gutter: max(24px, calc(50% - 590px + 24px)); position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; height: calc(var(--top-h) + var(--safe-t)); padding: var(--safe-t) max(var(--gutter), var(--safe-r)) 0 max(var(--gutter), var(--safe-l)); background: color-mix(in srgb, var(--bg) 88%, transparent); -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px); }
.topbar .brand { flex: none; }
.search { position: relative; flex: 1; max-width: 560px; margin: 0 auto; display: flex; align-items: center; }
.search-icon { position: absolute; left: 12px; color: var(--faint); pointer-events: none; }
.search-icon svg { width: 18px; height: 18px; }
.search input { min-height: 40px; padding: 0 36px 0 38px; border-color: transparent; background: var(--sunken); font-size: 15px; }
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.search input:focus { background: var(--surface); }
.search-key { position: absolute; right: 10px; min-width: 20px; height: 20px; padding: 0 5px; border: 1px solid var(--line-strong); border-radius: 5px; color: var(--faint); font: 12px/18px var(--mono); text-align: center; pointer-events: none; }
.search input:focus ~ .search-key, .search input:not(:placeholder-shown) ~ .search-key { display: none; }
.top-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.upload-button { margin-right: 6px; }
.avatar { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: var(--bg); font-size: 13px; font-weight: 650; }

.menu-anchor { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 220px; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--raised); box-shadow: var(--pop-shadow); }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 10px; border: 0; border-radius: 7px; background: none; color: var(--ink); font-size: 14px; text-align: left; white-space: nowrap; }
.menu-item:hover, .menu-item:focus-visible { background: var(--hover); outline: none; }
.menu-item svg { width: 18px; height: 18px; color: var(--muted); }
.menu-item.is-danger, .menu-item.is-danger svg { color: var(--danger); }
.menu-sep { height: 1px; margin: 6px 4px; background: var(--line); }
.menu-head { display: grid; gap: 2px; padding: 8px 10px 10px; }
.menu-head strong { color: var(--ink); }
.menu-head span { color: var(--muted); font-size: 13px; }
.account-menu { width: 280px; }
.storage { margin: 0 4px 6px; padding: 12px; border-radius: 9px; background: var(--sunken); font-size: 13px; }
.storage-row { display: flex; justify-content: space-between; color: var(--muted); }
.storage-row strong { color: var(--ink); font-weight: 600; }
.meter { height: 6px; margin: 8px 0; border-radius: 3px; background: var(--line); overflow: hidden; }
.meter span { display: block; height: 100%; width: 0; background: var(--ink); border-radius: 3px; transition: width .3s; }
.meter.is-high span { background: var(--danger); }
.storage-note { color: var(--muted); font-size: 12px; }

/* categories */
.cats { --gutter: max(24px, calc(50% - 590px + 24px)); position: sticky; top: calc(var(--top-h) + var(--safe-t)); z-index: 15; display: flex; gap: 6px; padding: 4px max(var(--gutter), var(--safe-r)) 10px max(var(--gutter), var(--safe-l)); background: color-mix(in srgb, var(--bg) 88%, transparent); -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px); overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; }
.cats::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 7px; flex: none; min-height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); color: var(--body); font-size: 14px; white-space: nowrap; transition: background-color .12s, border-color .12s; }
.chip:hover { border-color: var(--line-strong); }
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.chip-dot { width: 7px; height: 10px; border-radius: 1.5px; background: var(--c, var(--c-other)); }
.chip-count { color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] .chip-count { color: inherit; opacity: .7; }

.content { width: 100%; max-width: 1180px; margin: 0 auto; padding: 8px max(24px, var(--safe-r)) calc(48px + var(--safe-b)) max(24px, var(--safe-l)); }
.listbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; margin-bottom: 6px; }
.list-summary { color: var(--muted); font-size: 14px; }
.listbar-tools { display: flex; align-items: center; gap: 6px; }

/* file list */
.files { list-style: none; margin: 0; padding: 0; }
.files.is-list { border-top: 1px solid var(--line); }
.files:empty { border-top: 0; }
.file { position: relative; }
.files.is-list .file { border-bottom: 1px solid var(--line); }
.file-open { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 64px; padding: 10px 104px 10px 8px; border: 0; background: none; text-align: left; border-radius: 0; }
.files.is-list .file-open:hover { background: var(--hover); }
.file-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.file-name { color: var(--ink); font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { display: flex; gap: 12px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; }
.file-status { display: inline-flex; align-items: center; gap: 5px; }
.file-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.file-status.is-busy { color: var(--c-slide); }
.file-status.is-busy::before { animation: pulse 1.2s ease-in-out infinite; }
.file-status.is-error { color: var(--danger); }
@keyframes pulse { 50% { opacity: .25; } }
.file-actions { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); display: flex; gap: 2px; }
.file-actions .icon-btn { width: 40px; height: 40px; }
@media (hover: hover) and (pointer: fine) {
  .files.is-list .file-actions .file-download { opacity: 0; }
  .files.is-list .file:hover .file-download, .files.is-list .file:focus-within .file-download { opacity: 1; }
}
.file-thumb { display: none; }

.files.is-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.files.is-grid .file { border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); overflow: hidden; transition: border-color .12s; }
.files.is-grid .file:hover { border-color: var(--line-strong); }
.files.is-grid .file-open { flex-direction: column; align-items: stretch; gap: 0; padding: 0; min-height: 0; }
.files.is-grid .file-open > .spine { display: none; }
.files.is-grid .file-thumb { --c: var(--c-other); display: grid; place-items: center; position: relative; aspect-ratio: 4 / 3; background: color-mix(in srgb, var(--c) 10%, var(--surface)); border-bottom: 1px solid var(--line); overflow: hidden; }
.files.is-grid .file-thumb::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--c); }
.file-thumb-label { color: var(--c); font-size: 22px; font-weight: 700; letter-spacing: .04em; }
.file-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.file-thumb.has-image::before { display: none; }
.files.is-grid .file-main { padding: 10px 44px 12px 12px; }
.files.is-grid .file-name { font-size: 14px; }
.files.is-grid .file-meta { font-size: 12px; gap: 8px; }
.files.is-grid .file-actions { top: auto; bottom: 6px; transform: none; right: 2px; }
.files.is-grid .file-download { display: none; }

.skeleton { display: grid; gap: 1px; border-top: 1px solid var(--line); }
.skeleton i { display: block; height: 64px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, transparent, var(--hover), transparent) 0 0 / 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.empty { display: grid; justify-items: center; gap: 10px; padding: 72px 20px; text-align: center; }
.empty-shelf { display: flex; align-items: flex-end; gap: 5px; margin-bottom: 12px; }
.empty-shelf i { width: 14px; border-radius: 2px 3px 3px 2px; background: var(--line-strong); }
.empty-shelf i:nth-child(1) { height: 44px; } .empty-shelf i:nth-child(2) { height: 54px; } .empty-shelf i:nth-child(3) { height: 40px; transform: rotate(-9deg); transform-origin: bottom left; margin-left: 3px; }
.empty h2 { font-size: 18px; }
.empty p { max-width: 380px; color: var(--muted); }
.empty .btn { margin-top: 10px; }

/* drag & drop, upload tray */
.drop-overlay { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 24px; background: color-mix(in srgb, var(--bg) 78%, transparent); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.drop-target { display: grid; justify-items: center; gap: 12px; width: min(520px, 100%); padding: 56px 24px; border: 2px dashed var(--ink); border-radius: 18px; color: var(--ink); font-size: 18px; font-weight: 600; pointer-events: none; }
.drop-target svg { width: 34px; height: 34px; }
.tray { position: fixed; right: max(20px, var(--safe-r)); bottom: calc(20px + var(--safe-b)); z-index: 60; width: min(380px, calc(100vw - 32px)); max-height: min(60vh, 460px); display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 14px; background: var(--raised); box-shadow: var(--pop-shadow); overflow: hidden; }
.tray-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 16px; border-bottom: 1px solid var(--line); }
.tray-head h2 { font-size: 15px; }
.tray-list { list-style: none; margin: 0; padding: 4px 0; overflow-y: auto; }
.tray-item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 12px; padding: 8px 8px 8px 16px; }
.tray-item .spine { grid-row: span 2; }
.tray-name { color: var(--ink); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tray-state { grid-column: 2; color: var(--muted); font-size: 12px; }
.tray-state.is-error { color: var(--danger); }
.tray-state.is-done { color: var(--ok); }
.tray-bar { grid-column: 2; height: 3px; border-radius: 2px; background: var(--line); overflow: hidden; }
.tray-bar span { display: block; height: 100%; width: 0; background: var(--ink); transition: width .15s linear; }
.tray-item .icon-btn { grid-row: 1 / span 2; grid-column: 3; width: 34px; height: 34px; }

/* toasts */
.toasts { position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); z-index: 100; display: grid; gap: 8px; width: max-content; max-width: calc(100vw - 32px); transform: translateX(-50%); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-radius: 10px; background: var(--ink); color: var(--bg); font-size: 14px; box-shadow: var(--pop-shadow); animation: toast-in .18s ease-out; }
.toast svg { width: 18px; height: 18px; }
.toast.is-error { background: var(--danger); color: #fff; }
.toast.is-leaving { opacity: 0; transition: opacity .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

/* dialogs */
dialog { color: var(--body); }
dialog::backdrop { background: rgba(10, 13, 18, .45); }
.sheet-dialog { width: min(420px, calc(100vw - 32px)); padding: 24px; border: 0; border-radius: 16px; background: var(--raised); box-shadow: var(--pop-shadow); }
.sheet-dialog h2 { font-size: 18px; margin-bottom: 8px; }
.sheet-dialog p { color: var(--muted); margin-bottom: 18px; }
.sheet-dialog .field { margin-bottom: 16px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.details { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0 0 20px; font-size: 14px; }
.details dt { color: var(--muted); }
.details dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }

/* ---------- viewer ---------- */
.viewer { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: var(--reader-bg); color: var(--body); overflow: hidden; }
.viewer[open] { display: flex; flex-direction: column; }
.viewer::backdrop { background: var(--reader-bg); }
.viewer-bar { position: relative; z-index: 5; display: flex; align-items: center; gap: 6px; flex: none; min-height: calc(56px + var(--safe-t)); padding: var(--safe-t) max(10px, var(--safe-r)) 0 max(8px, var(--safe-l)); background: var(--surface); border-bottom: 1px solid var(--line); }
.viewer-title { flex: 1; min-width: 0; padding: 0 6px; }
.viewer-title h2 { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-title p { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.viewer-tools { display: flex; align-items: center; gap: 2px; }
.viewer-nav { display: flex; gap: 0; padding: 0 4px; margin: 0 2px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.viewer-body { position: relative; flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.viewer-body:focus { outline: none; }

.state { display: grid; place-items: center; align-content: center; gap: 10px; min-height: 100%; padding: 40px 24px calc(40px + var(--safe-b)); text-align: center; }
.state h3 { font-size: 17px; }
.state p { max-width: 420px; color: var(--muted); }
.state .btn { margin-top: 8px; }
.state-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 8px; }
.state-actions .btn { margin: 0; }
.spinner { width: 28px; height: 28px; border: 2.5px solid var(--line-strong); border-top-color: var(--ink); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* floating reader toolbar (PDF, image) */
.dock { position: absolute; left: 50%; bottom: calc(16px + var(--safe-b)); z-index: 6; display: flex; align-items: center; gap: 2px; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: color-mix(in srgb, var(--raised) 94%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); box-shadow: var(--pop-shadow); transform: translateX(-50%); transition: opacity .2s, transform .2s; max-width: calc(100% - 16px); }
.dock.is-hidden { opacity: 0; transform: translate(-50%, 12px); pointer-events: none; }
.dock .icon-btn { width: 38px; height: 38px; }
.dock-sep { width: 1px; height: 22px; margin: 0 4px; background: var(--line); }
.dock-page { display: flex; align-items: center; gap: 4px; padding: 0 4px; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dock-page input { width: 48px; min-height: 32px; padding: 0 4px; text-align: center; font-size: 14px; }
.dock-zoom { min-width: 50px; border: 0; background: none; color: var(--body); font-size: 13px; font-variant-numeric: tabular-nums; border-radius: 6px; height: 34px; }
.dock-zoom:hover { background: var(--hover); }

.findbar { position: absolute; top: 10px; right: max(12px, var(--safe-r)); z-index: 7; display: flex; align-items: center; gap: 2px; width: min(380px, calc(100% - 24px)); padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--raised); box-shadow: var(--pop-shadow); }
.findbar input { flex: 1; min-height: 36px; border-color: transparent; background: transparent; font-size: 15px; }
.findbar input:focus { box-shadow: none; }
.findbar-count { color: var(--muted); font-size: 12px; white-space: nowrap; padding: 0 6px; font-variant-numeric: tabular-nums; }
.findbar .icon-btn { width: 34px; height: 34px; }

/* PDF */
.pdf-scroll { position: absolute; inset: 0; overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 20px 12px calc(90px + var(--safe-b)); }
.pdf-pages { display: flex; flex-direction: column; align-items: center; gap: 14px; min-width: min-content; margin: 0 auto; }
.pdf-page { --scale-factor: 1; --user-unit: 1; --total-scale-factor: calc(var(--scale-factor) * var(--user-unit)); --scale-round-x: 1px; --scale-round-y: 1px; position: relative; flex: none; background: #fff; box-shadow: var(--page-shadow); border-radius: 2px; overflow: hidden; }
.pdf-page canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.pdf-page-num { position: absolute; left: 50%; bottom: -1px; transform: translate(-50%, 100%); }
.pdf-page.is-loading::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(transparent 0 22px, rgba(0,0,0,.035) 22px 30px); background-clip: content-box; padding: 9% 12%; }
.pdf-pages.is-night .pdf-page { background: #1b1d21; }
.pdf-pages.is-night canvas { filter: invert(.9) hue-rotate(180deg) contrast(.95); }
.textLayer { color-scheme: only light; position: absolute; text-align: initial; inset: 0; overflow: clip; opacity: 1; line-height: 1; -webkit-text-size-adjust: none; text-size-adjust: none; forced-color-adjust: none; transform-origin: 0 0; caret-color: CanvasText; z-index: 0; --min-font-size: 1; --text-scale-factor: calc(var(--total-scale-factor) * var(--min-font-size)); --min-font-size-inv: calc(1 / var(--min-font-size)); }
.textLayer :is(span, br) { color: transparent; position: absolute; white-space: pre; cursor: text; transform-origin: 0% 0%; }
.textLayer > :not(.markedContent), .textLayer .markedContent span:not(.markedContent) { z-index: 1; --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 span[role="img"] { -webkit-user-select: none; user-select: none; cursor: default; }
.textLayer ::selection { background: rgba(47, 91, 211, .28); }
.textLayer br::selection { background: transparent; }
.textLayer .endOfContent { display: block; position: absolute; inset: 100% 0 0; z-index: 0; cursor: default; -webkit-user-select: none; user-select: none; }
.textLayer.selecting .endOfContent { top: 0; }
.textLayer .hit { background: rgba(245, 180, 0, .38); border-radius: 2px; }
.textLayer .hit.is-current { background: rgba(240, 120, 0, .6); }

/* image */
.image-stage { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: grab; display: grid; place-items: center; background: var(--reader-bg); }
.image-stage.is-dragging { cursor: grabbing; }
.image-stage img { max-width: none; transform-origin: 0 0; position: absolute; left: 0; top: 0; -webkit-user-select: none; user-select: none; -webkit-user-drag: none; image-rendering: auto; }
.image-stage.is-pixelated img { image-rendering: pixelated; }
.image-stage.is-checker { background-color: var(--reader-bg); background-image: conic-gradient(var(--sunken) 25%, transparent 0 50%, var(--sunken) 0 75%, transparent 0); background-size: 20px 20px; }

/* media */
.media { display: grid; place-items: center; min-height: 100%; padding: 16px max(12px, var(--safe-r)) calc(16px + var(--safe-b)) max(12px, var(--safe-l)); }
.media video { width: 100%; max-width: 1280px; max-height: calc(100dvh - 120px); background: #000; border-radius: 8px; }
.audio-card { display: grid; justify-items: center; gap: 18px; width: min(520px, 100%); padding: 36px 24px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); text-align: center; }
.audio-card .spine { width: 64px; height: 84px; padding-bottom: 10px; }
.audio-card .spine::before { top: 12px; left: 12px; right: 9px; height: 3px; }
.audio-card .spine-label { font-size: 13px; }
.audio-card h3 { font-size: 17px; overflow-wrap: anywhere; }
.audio-card audio { width: 100%; }
.media-note { color: var(--muted); font-size: 13px; }

/* text & code */
.reader { min-height: 100%; background: var(--surface); }
.reader-inner { max-width: 760px; margin: 0 auto; padding: 36px max(22px, var(--safe-r)) calc(80px + var(--safe-b)) max(22px, var(--safe-l)); }
.reader.size-s { --reader-size: 15px; } .reader.size-m { --reader-size: 17px; } .reader.size-l { --reader-size: 19px; } .reader.size-xl { --reader-size: 22px; }
.reader.serif .prose, .reader.serif .plain { font-family: var(--serif); line-height: 1.95; }
.plain { margin: 0; color: var(--ink); font: var(--reader-size, 17px)/1.85 var(--font); white-space: pre-wrap; word-break: break-word; tab-size: 4; }
.prose { color: var(--ink); font-size: var(--reader-size, 17px); line-height: 1.8; }
.prose > :first-child { margin-top: 0; }
.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 { margin: 1.8em 0 .6em; line-height: 1.35; scroll-margin-top: 16px; }
.prose h1 { font-size: 1.75em; } .prose h2 { font-size: 1.4em; padding-bottom: .3em; border-bottom: 1px solid var(--line); } .prose h3 { font-size: 1.18em; } .prose h4 { font-size: 1em; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose pre, .prose table, .prose dl { margin: 0 0 1em; }
.prose a { color: var(--focus); text-decoration: underline; text-underline-offset: 3px; }
.prose ul, .prose ol { padding-left: 1.5em; }
.prose li + li { margin-top: .25em; }
.prose li > input[type="checkbox"] { margin-right: .4em; }
.prose blockquote { padding: .2em 1em; border-left: 3px solid var(--line-strong); color: var(--muted); }
.prose code { padding: .12em .35em; border-radius: 4px; background: var(--sunken); font-size: .86em; }
.prose pre { padding: 14px 16px; border-radius: 8px; background: var(--sunken); overflow-x: auto; font-size: .82em; line-height: 1.6; }
.prose pre code { padding: 0; background: none; font-size: inherit; }
.prose table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; font-size: .9em; }
.prose th, .prose td { padding: 6px 12px; border: 1px solid var(--line); }
.prose th { background: var(--sunken); }
.prose img { max-width: 100%; height: auto; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.reader-layout { display: grid; grid-template-columns: minmax(0, 1fr); }
.toc { display: none; }
@media (min-width: 1180px) {
  .reader-layout.has-toc { grid-template-columns: 240px minmax(0, 760px) 240px; justify-content: center; }
  .reader-layout.has-toc .reader-inner { margin: 0; width: 100%; }
  .reader-layout.has-toc .toc { display: block; position: sticky; top: 0; align-self: start; max-height: calc(100dvh - 60px); overflow-y: auto; padding: 40px 12px 40px 24px; font-size: 13px; }
}
.toc a { display: block; padding: 4px 8px; border-radius: 5px; color: var(--muted); line-height: 1.45; }
.toc a:hover { background: var(--hover); color: var(--ink); }
.toc a.lv-3 { padding-left: 20px; } .toc a.lv-4 { padding-left: 32px; }
.toc-title { padding: 0 8px 8px; color: var(--faint); font-size: 12px; }
.html-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }

.code { display: grid; grid-template-columns: auto minmax(0, 1fr); min-height: 100%; background: var(--surface); font: 13.5px/1.65 var(--mono); }
.reader.size-s .code { font-size: 12.5px; } .reader.size-l .code { font-size: 15px; } .reader.size-xl .code { font-size: 17px; }
.code-gutter { margin: 0; padding: 16px 12px calc(80px + var(--safe-b)) max(14px, var(--safe-l)); color: var(--faint); text-align: right; -webkit-user-select: none; user-select: none; border-right: 1px solid var(--line); background: var(--bg); position: sticky; left: 0; z-index: 1; }
.code-body { margin: 0; padding: 16px 20px calc(80px + var(--safe-b)); overflow-x: auto; color: var(--ink); tab-size: 4; }
.code.is-wrapped .code-body { white-space: pre-wrap; word-break: break-all; }
.code.is-wrapped .code-gutter { display: none; }
.code.is-wrapped { grid-template-columns: minmax(0, 1fr); }
.code-note { padding: 8px 16px; background: var(--sunken); color: var(--muted); font-size: 13px; text-align: center; }
/* syntax colours */
.hljs-comment, .hljs-quote { color: #8a919c; font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-doctag, .hljs-meta .hljs-keyword { color: #a1368f; }
.hljs-string, .hljs-regexp, .hljs-addition, .hljs-attribute, .hljs-meta .hljs-string { color: #1f7a4c; }
.hljs-number, .hljs-symbol, .hljs-bullet, .hljs-link { color: #b5531c; }
.hljs-title, .hljs-section, .hljs-title.function_ { color: #2f5bd3; }
.hljs-type, .hljs-built_in, .hljs-title.class_, .hljs-class .hljs-title { color: #946200; }
.hljs-attr, .hljs-variable, .hljs-template-variable, .hljs-params, .hljs-property { color: #7a4fb0; }
.hljs-name, .hljs-tag, .hljs-selector-id, .hljs-selector-class { color: #c0392f; }
.hljs-deletion { color: #c0392f; background: #fdecea; }
.hljs-addition { background: #e6f5ec; }
.hljs-meta { color: #6b7380; }
.hljs-emphasis { font-style: italic; } .hljs-strong { font-weight: 700; }
:root[data-theme="dark"] .hljs-keyword, :root[data-theme="dark"] .hljs-selector-tag, :root[data-theme="dark"] .hljs-literal { color: #e38bd2; }
:root[data-theme="dark"] .hljs-string, :root[data-theme="dark"] .hljs-regexp, :root[data-theme="dark"] .hljs-attribute { color: #7fd1a1; }
:root[data-theme="dark"] .hljs-number, :root[data-theme="dark"] .hljs-symbol, :root[data-theme="dark"] .hljs-bullet { color: #f0a46b; }
:root[data-theme="dark"] .hljs-title, :root[data-theme="dark"] .hljs-section { color: #8fb0ff; }
:root[data-theme="dark"] .hljs-type, :root[data-theme="dark"] .hljs-built_in, :root[data-theme="dark"] .hljs-title.class_ { color: #e9c46a; }
:root[data-theme="dark"] .hljs-attr, :root[data-theme="dark"] .hljs-variable, :root[data-theme="dark"] .hljs-params, :root[data-theme="dark"] .hljs-property { color: #c3a6f0; }
:root[data-theme="dark"] .hljs-name, :root[data-theme="dark"] .hljs-tag, :root[data-theme="dark"] .hljs-selector-class { color: #f28b82; }
:root[data-theme="dark"] .hljs-deletion { background: #3a1f1e; } :root[data-theme="dark"] .hljs-addition { background: #173225; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hljs-keyword, :root:not([data-theme="light"]) .hljs-selector-tag, :root:not([data-theme="light"]) .hljs-literal { color: #e38bd2; }
  :root:not([data-theme="light"]) .hljs-string, :root:not([data-theme="light"]) .hljs-regexp, :root:not([data-theme="light"]) .hljs-attribute { color: #7fd1a1; }
  :root:not([data-theme="light"]) .hljs-number, :root:not([data-theme="light"]) .hljs-symbol, :root:not([data-theme="light"]) .hljs-bullet { color: #f0a46b; }
  :root:not([data-theme="light"]) .hljs-title, :root:not([data-theme="light"]) .hljs-section { color: #8fb0ff; }
  :root:not([data-theme="light"]) .hljs-type, :root:not([data-theme="light"]) .hljs-built_in, :root:not([data-theme="light"]) .hljs-title.class_ { color: #e9c46a; }
  :root:not([data-theme="light"]) .hljs-attr, :root:not([data-theme="light"]) .hljs-variable, :root:not([data-theme="light"]) .hljs-params, :root:not([data-theme="light"]) .hljs-property { color: #c3a6f0; }
  :root:not([data-theme="light"]) .hljs-name, :root:not([data-theme="light"]) .hljs-tag, :root:not([data-theme="light"]) .hljs-selector-class { color: #f28b82; }
  :root:not([data-theme="light"]) .hljs-deletion { background: #3a1f1e; } :root:not([data-theme="light"]) .hljs-addition { background: #173225; }
}
mark.text-hit { background: var(--mark); color: inherit; border-radius: 2px; }
mark.text-hit.is-current { background: var(--mark-active); color: #000; }

/* table */
.sheet { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--surface); }
.sheet-scroll { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.sheet-grid { border-collapse: separate; border-spacing: 0; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--ink); }
.sheet-grid th, .sheet-grid td { min-width: 64px; max-width: 360px; height: 30px; padding: 4px 10px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.sheet-grid td.is-num { text-align: right; }
.sheet-grid td:hover { white-space: normal; overflow-wrap: anywhere; }
.sheet-grid thead th { position: sticky; top: 0; z-index: 2; background: var(--bg); color: var(--muted); font-weight: 500; font-size: 12px; text-align: center; }
.sheet-grid tbody th { position: sticky; left: 0; z-index: 1; min-width: 44px; background: var(--bg); color: var(--muted); font-weight: 400; font-size: 12px; text-align: center; }
.sheet-grid thead th:first-child { left: 0; z-index: 3; }
.sheet-grid.has-header tbody tr:first-child td { position: sticky; top: 30px; z-index: 1; background: var(--surface); font-weight: 600; box-shadow: inset 0 -1px 0 var(--line-strong); }
.sheet-tabs { display: flex; gap: 2px; flex: none; padding: 6px max(8px, var(--safe-l)) calc(6px + var(--safe-b)); border-top: 1px solid var(--line); background: var(--bg); overflow-x: auto; scrollbar-width: thin; }
.sheet-tab { flex: none; min-height: 34px; padding: 0 14px; border: 0; border-radius: 7px; background: none; color: var(--muted); font-size: 13px; white-space: nowrap; }
.sheet-tab:hover { background: var(--hover); color: var(--ink); }
.sheet-tab[aria-selected="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.sheet-note { padding: 6px 14px; border-top: 1px solid var(--line); background: var(--bg); color: var(--muted); font-size: 12px; }
.sheet-empty { padding: 40px; text-align: center; color: var(--muted); }

/* archive, font, info */
.panel { max-width: 860px; margin: 0 auto; padding: 24px max(16px, var(--safe-r)) calc(48px + var(--safe-b)) max(16px, var(--safe-l)); }
.panel-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.panel-head h3 { font-size: 16px; }
.panel-head p { color: var(--muted); font-size: 13px; }
.entries { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.entry { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 6px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
.entry:last-child { border-bottom: 0; }
.entry svg { width: 18px; height: 18px; color: var(--faint); }
.entry.is-dir svg { color: var(--c-archive); }
.entry-name { flex: 1; min-width: 0; color: var(--ink); overflow-wrap: anywhere; }
.entry-name .entry-path { color: var(--faint); }
.entry-size { color: var(--muted); font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.font-specimen { display: grid; gap: 22px; }
.font-specimen textarea { width: 100%; min-height: 80px; padding: 14px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink); font-size: 32px; line-height: 1.3; resize: vertical; }
.font-line { color: var(--ink); overflow-wrap: anywhere; line-height: 1.25; }
.font-line small { display: block; margin-bottom: 4px; color: var(--faint); font: 12px var(--font); }
.info-card { display: grid; gap: 18px; padding: 24px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.info-head { display: flex; align-items: center; gap: 14px; }
.info-head h3 { font-size: 17px; overflow-wrap: anywhere; }
.info-head p { color: var(--muted); font-size: 14px; }
.hex { margin: 0; padding: 14px 16px; border-radius: 8px; background: var(--sunken); color: var(--body); font: 12.5px/1.6 var(--mono); overflow-x: auto; white-space: pre; }
.hex-title { color: var(--muted); font-size: 13px; margin-bottom: -10px; }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  :root { --top-h: 56px; }
  body { font-size: 15px; }
  .topbar { gap: 8px; padding-left: max(14px, var(--safe-l)); padding-right: max(10px, var(--safe-r)); }
  .topbar .brand span { display: none; }
  .search { margin: 0; }
  .search-key { display: none; }
  .upload-text { display: none; }
  .upload-button { width: 40px; padding: 0; margin-right: 2px; }
  .cats { padding-left: max(14px, var(--safe-l)); padding-right: max(14px, var(--safe-r)); }
  .content { padding-left: max(14px, var(--safe-l)); padding-right: max(14px, var(--safe-r)); }
  .file-open { padding-right: 52px; padding-left: 2px; gap: 12px; }
  .file-actions .file-download { display: none; }
  .files.is-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .files.is-grid .file-thumb-label { font-size: 18px; }
  .viewer-bar { gap: 2px; }
  .viewer-nav { border: 0; padding: 0; margin: 0; }
  #viewer-spine { display: none; }
  .viewer-tools .icon-btn.wide-only { display: none; }
  .tray { left: max(12px, var(--safe-l)); right: max(12px, var(--safe-r)); width: auto; bottom: calc(12px + var(--safe-b)); }
  .reader-inner { padding-top: 24px; }
  .dock { bottom: calc(10px + var(--safe-b)); }
  .dock .icon-btn { width: 36px; height: 36px; }
  .details { grid-template-columns: 1fr; gap: 2px; }
  .details dd { margin-bottom: 8px; }
}
@media (max-width: 420px) {
  .viewer-nav { display: none; }
  .dock-zoom { display: none; }
}
@media (min-width: 1500px) {
  .content { max-width: 1320px; }
  .topbar, .cats { --gutter: calc(50% - 660px + 24px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media print {
  .topbar, .cats, .listbar, .viewer-bar, .dock, .tray, .toasts { display: none !important; }
}
