.drawer-is-open { overflow: hidden; }
.reading-scroll { max-width: 100%; scrollbar-width: thin; scrollbar-color: var(--faint) transparent; overscroll-behavior-x: contain; }
.reading-scroll:focus-visible { outline: 2px solid var(--ember); outline-offset: 3px; }
.reading-scroll-hint { display: block; margin: .3rem 0 .65rem; color: var(--muted); font: var(--fs-12)/1.5 var(--body); }
.reading-scroll-hint[hidden] { display: none; }
.figure-expand { display: block; min-height: 44px; padding: .4rem 0; border: 0; background: none; color: var(--muted); font: var(--fs-13)/1.5 var(--body); cursor: zoom-in; }
.figure-expand:hover { color: var(--ink); }
.figure-expand:focus-visible { outline: 2px solid var(--ember); outline-offset: 3px; }
.figure-viewer { width: min(1100px, calc(100vw - 2rem)); max-width: none; height: min(820px, calc(100dvh - 2rem)); max-height: none; padding: 0; margin: auto; border: 1px solid var(--rule); border-radius: var(--r-10); background: var(--paper); color: var(--ink); }
.figure-viewer[open] { display: flex; flex-direction: column; }
.figure-viewer::backdrop { background: #000a; }
.figure-viewer > header { display: flex; align-items: center; flex: none; gap: .6rem; padding: .6rem .8rem; border-bottom: 1px solid var(--rule); }
.figure-viewer h2 { flex: 1; min-width: 0; font: 500 var(--fs-14)/1.5 var(--body); }
.figure-viewer button { display: inline-grid; place-items: center; flex: none; min-width: 44px; min-height: 44px; padding: .4rem .6rem; border: 1px solid var(--rule); border-radius: var(--r-6); background: none; color: var(--ink); font: var(--fs-13)/1.4 var(--body); cursor: pointer; }
.figure-viewer button:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }
.figure-viewer-stage { flex: 1; min-height: 0; overflow: auto; padding: 1rem; overscroll-behavior: contain; }
.figure-viewer-stage img { display: block; width: var(--figure-width); max-width: none; height: auto; margin: 0 auto; }
.figure-viewer.is-fit .figure-viewer-stage img { width: 100%; max-width: var(--figure-width); }
.figure-viewer-credit { flex: none; max-height: 25%; overflow-y: auto; padding: .65rem 1rem; border-top: 1px solid var(--rule); font: var(--fs-13)/1.6 var(--body); color: var(--muted); }
.figure-viewer-credit:empty { display: none; }
html.figure-is-open { overflow: hidden; }
.topbar-brand .brand-short { display: none; }

@media (max-width: 760px) {
  html { scroll-padding-top: 112px; }
  body .topbar { height: 96px; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; grid-template-rows: 52px 44px; gap: 0 4px; padding: 0 12px; }
  body .topbar > .menu { grid-row: 1; grid-column: 1; }
  body .topbar > .topbar-brand { display: flex; grid-row: 1; grid-column: 2; min-width: 0; min-height: 44px; }
  body .topbar-brand .brand-full { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  body .topbar-brand .brand-short { display: inline; font-size: var(--fs-14); letter-spacing: .02em; }
  body .topbar .topbar-right { grid-row: 1; grid-column: 3; gap: 4px; }
  body .topbar .icon-btn, body .topbar .lang-btn { width: 44px; min-width: 44px; height: 44px; display: inline-flex; justify-content: center; align-items: center; }
  body .topbar .lang-btn:not(:hover) { border-color: transparent; }   /* a 44px box outweighed the icons beside it */
  body .topbar .repo-btn.repo-pill, body .topbar .repo-btn { display: none; }
  body .topbar > .topbar-tabs { grid-row: 2; grid-column: 1 / -1; width: 100%; height: 44px; padding: 0; gap: 8px; mask-image: none; -webkit-mask-image: none; scrollbar-width: thin; scrollbar-color: var(--rule) transparent; overscroll-behavior-x: contain; }
  body .topbar-tabs::-webkit-scrollbar { display: block; height: 2px; }
  body .topbar-tabs::-webkit-scrollbar-thumb { background: var(--rule); }
  body .topbar-tabs a { padding: 0 8px; min-height: 44px; }
  body .topbar-tabs a::after { left: 8px; right: 8px; height: 2px; }
  body .topbar-tabs a:focus-visible { outline-offset: -3px; }
  body .side { top: 96px; height: calc(100dvh - 96px); }
  body .side-scrim { inset-block-start: 96px; }
  body .reader-hub { top: 100px; }
  body .shell { padding-inline: 16px; }
  body main { padding-top: 1rem; }
  .prose .article-head { margin-bottom: 1.4rem; padding-block: .5rem 1rem; }
  .prose .article-head h1 { overflow-wrap: anywhere; }
  html.lang-zh .prose .article-head h1 { line-height: 1.45; letter-spacing: 0; }
  html.lang-zh .article-body > :is(p, ul, ol, blockquote) { line-height: 1.85; }
  .article-body :is(p, li, td, figcaption) { overflow-wrap: anywhere; }
  .article-body .term-en { white-space: normal; word-break: normal; }
  .prose .mobile-toc a { min-height: 44px; padding-block: .65rem; }
  .prose .table-wrap table { min-width: var(--reading-table-width, 100%); }
  .prose .table-wrap :is(th, td) { line-height: 1.65; }
  .prose .table-wrap :is(th, td):first-child { min-width: 6rem; }
  html.lang-zh .prose th { letter-spacing: 0; }
  .prose .copy-btn { position: static; display: block; opacity: 1; min-height: 44px; margin: 0 0 0 auto; padding: .4rem .75rem; }
  .prose .code-wrap pre { margin-bottom: 0; }
  .prose .tx-lab .ctl-row { grid-template-columns: minmax(0, 1fr); }
  .prose .tx-lab .ctl { grid-template-columns: minmax(0, 1fr) auto; gap: .4rem; }
  .prose .tx-lab .ctl input[type="range"] { grid-row: 2; grid-column: 1 / -1; min-height: 36px; }
  .prose .tx-lab .ctl-label { white-space: normal; }
  body .ch-bar { top: 96px; }
  body .ch-field, body .ch-views button, body .ch-panel-step, body .ch-panel-close { min-height: 44px; min-width: 44px; }
  .figure-viewer { width: 100vw; height: 100dvh; border: 0; border-radius: 0; }
  .figure-viewer > header { padding-top: max(.5rem, env(safe-area-inset-top)); }
  .figure-viewer-credit { padding-bottom: max(.65rem, env(safe-area-inset-bottom)); }
}
@media print {
  .reading-scroll-hint, .figure-expand, .figure-viewer { display: none !important; }
}
