@property --shade { syntax: "<number>"; inherits: true; initial-value: 0; }
@font-face { font-family: "Inter"; src: url("fonts/inter.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("fonts/jetbrains-mono.woff2") format("woff2"); font-weight: 100 800; font-display: swap; }

:root {
  --ink: #1d1d1f;
  --ink-2: #57575e;
  --ground: #f5f5f7;
  --page: #ffffff;
  --hair: #e2e2e7;
  --hair-strong: #8c8c96;
  --accent: #2447a8;
  --tint: color-mix(in oklab, var(--accent) 9%, white);
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --bar: 3.5rem;
  --nav: 4.25rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 400 1rem/1.5 var(--sans); }
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
button, input { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
::selection { background: color-mix(in oklab, var(--accent) 22%, white); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr-only { position: fixed; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: fixed; top: .75rem; left: .75rem; z-index: 50; padding: .625rem 1rem; background: var(--ink); color: #fff; border-radius: 8px; transform: translateY(-200%); }
.skip:focus { transform: none; }
.noscript { padding: 2rem; text-align: center; }
.icon { width: 1.25rem; height: 1.25rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* Library */
.library { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; gap: clamp(1.5rem, 4vh, 3rem); width: min(100%, 96rem); margin-inline: auto; padding: clamp(2rem, 5vh, 4rem) clamp(1.25rem, 2.6vw, 3rem) clamp(1.25rem, 3vh, 2rem); }
.lib-head { display: grid; grid-template-columns: minmax(0, 3fr) minmax(16rem, 1fr); gap: 2rem 4rem; align-items: end; }
.lib-head h1 { font-size: clamp(2.5rem, 6.4vw, 6rem); line-height: 1.04; font-weight: 650; letter-spacing: -.035em; text-wrap: balance; }
.lib-head p { font-size: clamp(1.0625rem, 1.35vw, 1.3125rem); line-height: 1.4; color: var(--ink-2); text-wrap: pretty; padding-bottom: .4em; }
.lib-shelf { display: flex; align-items: flex-end; min-height: 0; }
.shelf { width: 100%; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: clamp(.75rem, 1.2vw, 1.5rem); padding-bottom: 1.25rem; border-bottom: 1px solid var(--hair-strong); }
.lib-foot { display: flex; justify-content: space-between; gap: 2rem; align-items: baseline; color: var(--ink-2); }
.shelf-note { font-size: clamp(1rem, 1.25vw, 1.25rem); color: var(--ink); }
.shelf-note strong { font-weight: 600; }
.shelf-note span { color: var(--ink-2); }
.keys { font-size: .875rem; white-space: nowrap; }
kbd { display: inline-block; min-width: 1.6em; padding: .05em .4em; text-align: center; font: 500 .8125rem/1.5 var(--sans); background: var(--page); border: 1px solid var(--hair); border-bottom-width: 2px; border-radius: 5px; }
.shelf-aside { display: none; }

/* Book cover */
.cover { position: relative; display: block; width: 100%; aspect-ratio: 5 / 8; max-height: 56dvh; margin-inline: auto; text-align: start; border-radius: 3px 7px 7px 3px; transition: transform .5s var(--ease-out); }
.cover-face { position: absolute; inset: 0; container-type: inline-size; display: flex; flex-direction: column; color: #fff; background: url("cloth.png") 0 0 / 120px 120px, var(--c); background-blend-mode: soft-light; border-radius: inherit; overflow: hidden; box-shadow: 0 1px 2px rgb(20 20 30 / .18), 0 10px 22px -8px rgb(20 20 30 / .32); transition: box-shadow .5s var(--ease-out); }
.cover-face::before { content: ""; position: absolute; inset: 0 auto 0 7%; width: 2px; background: rgb(0 0 0 / .26); box-shadow: 2px 0 0 rgb(255 255 255 / .1); pointer-events: none; }
.cover-in { position: relative; flex: 1; display: flex; flex-direction: column; padding: 10cqw 7cqw 9cqw 13cqw; }
.cover-title { font-size: 10cqw; line-height: 1.12; font-weight: 620; letter-spacing: -.02em; }
.cover-motif { width: 62cqw; max-height: 52cqh; margin: auto 0; color: var(--foil); fill: none; stroke: currentColor; stroke-width: 2; }
.cover-motif .on { fill: currentColor; stroke: none; }
.cover-num { font-size: 8cqw; font-weight: 500; letter-spacing: .04em; }
.cover:hover, .cover.is-selected { transform: translateY(-10px); }
.cover:hover .cover-face, .cover.is-selected .cover-face { box-shadow: 0 2px 4px rgb(20 20 30 / .16), 0 22px 36px -12px rgb(20 20 30 / .42); }
.cover:active { transform: translateY(-5px) scale(.985); transition-duration: .12s; }
.cover:focus-visible { outline-offset: 5px; border-radius: 7px; }

/* Reader */
.reader:focus { outline: none; }
.reader { position: fixed; inset: 0; z-index: 10; display: grid; grid-template-rows: calc(var(--bar) + env(safe-area-inset-top)) minmax(0, 1fr) calc(var(--nav) + env(safe-area-inset-bottom)); background: var(--ground); --tint: color-mix(in oklab, var(--accent) 9%, white); }
.reader-bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem; padding: env(safe-area-inset-top) clamp(.5rem, 2vw, 1.5rem) 0; }
.bar-btn { justify-self: start; display: inline-flex; align-items: center; gap: .25rem; min-height: 2.75rem; padding: 0 .75rem 0 .375rem; border-radius: 8px; font-weight: 500; color: var(--accent); transition: background-color .2s; }
.bar-btn:hover { background: var(--tint); }
.reader-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader-count { justify-self: end; padding-right: .75rem; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.stage { position: relative; min-height: 0; display: grid; place-items: center; padding: 0 clamp(1rem, 3vw, 2.5rem); }
.reader-nav { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 1rem; padding: 0 clamp(.5rem, 2vw, 1.5rem) env(safe-area-inset-bottom); }
.nav-btn { justify-self: start; max-width: 100%; display: inline-flex; align-items: center; gap: .375rem; min-height: 2.75rem; min-width: 2.75rem; padding: 0 .75rem; border-radius: 10px; font-weight: 500; transition: background-color .2s, transform .2s var(--ease-out); }
.nav-btn:hover { background: rgb(0 0 0 / .05); }
.nav-btn:active { transform: scale(.97); }
.nav-next { justify-self: end; background: var(--accent); color: #fff; padding-inline: 1.125rem .75rem; }
.nav-next:hover { background: color-mix(in oklab, var(--accent) 86%, black); }
.nav-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticks { display: flex; }
.tick { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; }
.tick::before { content: ""; width: 2rem; height: 4px; border-radius: 2px; background: var(--hair-strong); transition: background-color .3s; }
.tick:hover::before { background: var(--ink-2); }
.tick[aria-current="page"]::before { background: var(--accent); }

/* Open book */
.book { position: relative; container-type: inline-size; width: min(100%, 92rem, calc((100dvh - var(--bar) - var(--nav) - 1rem) * 1.72)); aspect-ratio: 1.72; display: grid; grid-template-columns: 1fr 1fr; perspective: 2600px; border-radius: 6px; filter: drop-shadow(0 18px 28px rgb(20 20 30 / .14)); }
.sheet, .face { background: var(--page); overflow: hidden auto; scrollbar-width: thin; scrollbar-color: var(--hair) transparent; }
.sheet.l, .face.back { border-radius: 6px 0 0 6px; box-shadow: inset -34px 0 34px -30px rgb(20 20 30 / .2); }
.sheet.r, .face.front { border-radius: 0 6px 6px 0; box-shadow: inset 34px 0 34px -30px rgb(20 20 30 / .2); }
.leaf { position: absolute; inset: 0 0 0 50%; transform-origin: left center; transform-style: preserve-3d; will-change: transform; z-index: 3; }
.face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; }
.face.back { transform: rotateY(180deg); }
.face::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgb(20 20 30 / .18), transparent 70%); opacity: var(--shade, 0); pointer-events: none; }
.face.back::after { background: linear-gradient(270deg, rgb(20 20 30 / .18), transparent 70%); }

/* Phone pager */
.pager { position: absolute; inset: 0; display: flex; overflow: auto hidden; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: none; background: var(--page); container-type: inline-size; }
.pager::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; scroll-snap-align: start; scroll-snap-stop: always; overflow: hidden auto; overscroll-behavior-y: contain; }

/* Page content */
.pg { --t-h: clamp(1.875rem, 4.3cqi, 4.5rem); --t-lede: clamp(1.125rem, 2.2cqi, 2.25rem); --t-body: clamp(1.0625rem, 1.9cqi, 1.875rem); --t-small: clamp(.9375rem, 1.55cqi, 1.5rem); min-height: 100%; display: flex; flex-direction: column; gap: 1.1em; padding: clamp(1.5rem, 3.8cqi, 3.75rem) clamp(1.25rem, 3.8cqi, 3.75rem) clamp(1rem, 2.2cqi, 2rem); font-size: var(--t-body); }
.pg h2 { font-size: var(--t-h); line-height: 1.08; font-weight: 650; letter-spacing: -.028em; text-wrap: balance; color: var(--accent); }
.pg h3 { font-size: var(--t-lede); line-height: 1.2; font-weight: 620; letter-spacing: -.015em; }
.lede { font-size: var(--t-lede); line-height: 1.38; text-wrap: pretty; max-width: 34em; }
.points { display: grid; grid-template-columns: minmax(0, 1fr); gap: .55em; }
.points li { overflow-wrap: anywhere; position: relative; padding-left: 1.05em; line-height: 1.36; text-wrap: pretty; }
.points li::before { content: ""; position: absolute; left: 0; top: .52em; width: .4em; height: .4em; border-radius: 50%; background: var(--accent); }
.theme { font: 500 var(--t-small)/1.4 var(--mono); color: var(--ink-2); }
.folio { margin-top: auto; padding-top: .75em; display: flex; justify-content: space-between; gap: 1em; font-size: var(--t-small); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.toc { display: grid; border-top: 1px solid var(--hair); }
.toc button { width: 100%; min-height: 2.75rem; display: flex; justify-content: space-between; align-items: center; gap: 1em; padding: .5em 0; text-align: start; font-weight: 500; border-bottom: 1px solid var(--hair); transition: color .2s, padding .3s var(--ease-out); }
.toc button:hover { color: var(--accent); padding-left: .3em; }
.toc span:last-child { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.refs { display: grid; border-top: 1px solid var(--hair); }
.refs div { display: grid; grid-template-columns: 6.5em minmax(0, 1fr); gap: 1em; padding: .55em 0; border-bottom: 1px solid var(--hair); }
.refs dt { color: var(--ink-2); }

/* Figures */
.fig { display: flex; flex-direction: column; gap: .8em; font-size: var(--t-small); line-height: 1.4; min-width: 0; }
.fig-head { display: grid; gap: .1em; }
.fig-head strong { font-size: var(--t-lede); line-height: 1.2; font-weight: 620; letter-spacing: -.015em; }
.fig-head span { color: var(--ink-2); }
.mono { font-family: var(--mono); font-variant-ligatures: none; font-variant-numeric: tabular-nums; }
.seg { display: flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: #ececf0; border-radius: 10px; width: fit-content; max-width: 100%; }
.seg button { min-height: 2.75rem; padding: .25em .85em; border-radius: 8px; font-weight: 500; transition: background-color .2s, color .2s, box-shadow .2s; }
.seg button:hover { background: rgb(255 255 255 / .6); }
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; box-shadow: 0 1px 2px rgb(20 20 30 / .22); }
.result { padding: .8em 1em; background: var(--tint); border-radius: 10px; line-height: 1.4; min-height: 3.6em; text-wrap: pretty; }
.result strong { font-weight: 620; }
.result.bad { background: #fdeceb; }
.stat { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5em, 1fr)); gap: .75em 1.25em; }
.stat div { display: grid; gap: .05em; min-width: 0; }
.stat dt { color: var(--ink-2); }
.stat dd { font: 600 1.12em/1.25 var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat dd.bignum { white-space: normal; }
.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tbl th { text-align: start; font-weight: 500; color: var(--ink-2); padding: .3em .6em .3em 0; border-bottom: 1px solid var(--hair-strong); }
.tbl td { overflow-wrap: anywhere; padding: .45em .6em .45em 0; border-bottom: 1px solid var(--hair); transition: background-color .25s; }
.tbl td:first-child { padding-left: .35em; }
.tbl th:first-child { padding-left: .35em; }
.tbl tr.dim td { color: var(--ink-2); }
.tbl tr.hit td { background: var(--tint); font-weight: 600; }
.range { display: grid; gap: .3em; }
.range label { display: flex; justify-content: space-between; gap: 1em; font-weight: 500; }
.range output { font-family: var(--mono); font-weight: 600; color: var(--accent); }
input[type="range"] { width: 100%; height: 2.75rem; margin: 0; accent-color: var(--accent); background: transparent; touch-action: pan-y; cursor: pointer; }
.check { display: inline-flex; align-items: center; gap: .6em; min-height: 2.75rem; font-weight: 500; cursor: pointer; }
.check input { width: 1.25rem; height: 1.25rem; accent-color: var(--accent); margin: 0; }
.text-in { display: grid; gap: .3em; }
.text-in label { font-weight: 500; }
.text-in input { width: 100%; min-height: 3rem; padding: .4em .7em; font: 500 max(1rem, 1.15em) var(--mono); background: var(--page); border: 1px solid var(--hair-strong); border-radius: 8px; caret-color: var(--accent); }
.text-in input[aria-invalid="true"] { border-color: #b3261e; }
.chips { display: flex; flex-wrap: wrap; gap: .4em; }
.chips button { min-height: 2.75rem; padding: .2em .7em; font-family: var(--mono); border: 1px solid var(--hair-strong); border-radius: 8px; transition: background-color .2s, border-color .2s; }
.chips button:hover { background: var(--tint); border-color: var(--accent); }
.chips button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Layer stack */
.stack { display: grid; gap: 3px; }
.stack button { display: flex; gap: .8em; align-items: center; min-height: 2.75rem; padding: 0 .8em; background: #ececf0; border-radius: 7px; font-weight: 500; text-align: start; transition: background-color .2s, color .2s; }
.stack button:hover { background: #e0e0e6; }
.stack button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.stack .mono { width: 1em; }

/* Hop track */
.track { position: relative; display: flex; justify-content: space-between; padding: 1.6em 0 .25em; }
.track::before { content: ""; position: absolute; left: 2.25em; right: 2.25em; top: 2.85em; height: 2px; background: var(--hair-strong); }
.node { position: relative; display: grid; justify-items: center; gap: .3em; width: 4.5em; font-weight: 500; text-align: center; white-space: nowrap; }
.node i { width: 2.5em; height: 2.5em; border-radius: 50%; background: var(--page); border: 2px solid var(--ink); }
.node.router i { border-radius: 8px; }
.pkt { position: absolute; top: 2.3em; left: 0; width: 1.1em; height: 1.1em; margin-left: -.55em; border-radius: 3px; background: var(--accent); box-shadow: 0 2px 6px rgb(20 20 30 / .3); transition: left .7s var(--ease-out); }

/* Two networks */
.nets { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: .6em; align-items: center; }
.net { display: grid; gap: .35em; padding: .7em; border: 1px solid var(--hair-strong); border-radius: 10px; min-width: 0; }
.net > span { font-weight: 600; }
.host { display: flex; justify-content: space-between; align-items: center; gap: .3em; min-height: 2em; padding: 0 .45em; font: 500 .92em var(--mono); background: #f0f0f3; border-radius: 6px; transition: background-color .3s, color .3s; }
.host.on { background: var(--accent); color: #fff; }
.host .icon { width: 1em; height: 1em; stroke-width: 2.5; }
.rtr { padding: .6em .5em; text-align: center; font-weight: 600; background: var(--ink); color: #fff; border-radius: 8px; }

/* Nested frame */
.frame { padding: .6em; border: 2px solid var(--accent); border-radius: 10px; transition: border-color .3s, opacity .3s; }
.frame.off { border: 2px dashed var(--hair-strong); }
.frame > span { display: block; margin-bottom: .4em; font-weight: 600; }
.frame.off > span { color: var(--ink-2); }
.packet { display: flex; flex-wrap: wrap; gap: .4em 1em; justify-content: space-between; padding: .6em .7em; background: #f0f0f3; border-radius: 6px; font-family: var(--mono); }
.packet b { font-weight: 600; border-radius: 3px; transition: background-color .3s, color .3s; padding: 0 .2em; }
.packet b.on { background: var(--accent); color: #fff; }

/* Bits */
.bits { display: grid; gap: .3em; }
.bit-row { display: grid; grid-template-columns: 2.6em repeat(8, minmax(0, 1fr)); gap: 3px; align-items: center; }
.bit-row > span { font: 600 1.15em var(--mono); font-variant-numeric: tabular-nums; }
.bit-row small { font: 500 .88em var(--mono); text-align: center; color: var(--ink-2); }
.bit { height: 2.6em; min-height: 32px; font: 600 1.05em var(--mono); background: #ececf0; border-radius: 5px; transition: background-color .15s, color .15s, transform .15s; }
.bit:hover { background: #dedee5; }
.bit:active { transform: scale(.92); }
.bit[aria-pressed="true"] { background: var(--accent); color: #fff; }
.dotted, .big-addr { display: block; min-width: 0; }
.dotted { font: 600 clamp(1.4em, 5cqi, 2em)/1.2 var(--mono); letter-spacing: -.02em; }
.strip { display: grid; grid-template-columns: repeat(32, minmax(0, 1fr)); gap: 1px; }
.strip i { height: 1.6em; background: #dcdce2; transition: background-color .2s; }
.strip i.n { background: var(--accent); }
.strip i:nth-child(8n):not(:last-child) { margin-right: 3px; }
.legend { display: flex; flex-wrap: wrap; gap: .2em 1.2em; color: var(--ink-2); }
.legend b { display: inline-block; width: .8em; height: .8em; margin-right: .4em; border-radius: 2px; background: #dcdce2; vertical-align: -.05em; }
.legend b.n { background: var(--accent); }

/* Header grid */
.hdr { display: grid; grid-template-columns: repeat(32, minmax(0, 1fr)); gap: 2px; }
.hdr button { grid-column: span var(--b); min-width: 0; min-height: 2.75rem; padding: .1em .3em; overflow: hidden; font-weight: 500; line-height: 1.1; background: #ececf0; border-radius: 4px; transition: background-color .2s, color .2s; }
.hdr button:hover { background: #dedee5; }
.hdr button.key { box-shadow: inset 0 0 0 1.5px var(--accent); }
.hdr button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.hdr .l { display: none; }
.hdr .s { display: inline; }
@container (max-width: 40rem) { .hdr button { grid-column: span var(--bn, var(--b)); } }
@container (min-width: 56rem) {
  .fig { gap: 1.05em; }
  .hdr .l { display: inline; }
  .hdr .s { display: none; }
  .hdr button { min-height: 3em; padding: .1em .25em; }
  .hdr button.tight { padding-inline: .1em; font-size: max(.76em, .875rem); }
  .stack button { min-height: max(2.45em, 2.75rem); }
  .tbl td { padding-block: .3em; }
  .bit { height: 3em; min-height: 2.75rem; }
  .pg > .qr { display: flex; flex-wrap: wrap; align-items: center; gap: .5em 1.25em; }
  .pg > .qr img { flex: none; width: 16cqi; min-width: 0; }
}
.size-bar { display: flex; height: 2.4em; border-radius: 6px; overflow: hidden; font-weight: 500; }
.size-bar span { display: grid; place-items: center; min-width: 0; white-space: nowrap; overflow: hidden; background: var(--accent); color: #fff; transition: flex-basis .35s var(--ease-out); }
.size-bar span + span { background: var(--tint); color: var(--ink); }

/* TTL */
.hops { display: flex; gap: .3em; }
.hops li { flex: 1; min-width: 0; display: grid; justify-items: center; gap: .1em; padding: .5em .1em; background: #f0f0f3; border-radius: 7px; transition: background-color .3s, color .3s; }
.hops li b { font: 600 1.3em var(--mono); }
.hops li.at { background: var(--accent); color: #fff; }
.hops li.drop { background: #b3261e; color: #fff; }
.hops li.gone { color: var(--ink-2); }
.btn { min-height: 2.75rem; padding: .3em 1em; font-weight: 500; border-radius: 9px; background: var(--accent); color: #fff; transition: background-color .2s, transform .15s; }
.btn:hover { background: color-mix(in oklab, var(--accent) 86%, black); }
.btn:active { transform: scale(.97); }
.btn:disabled { background: #e4e4e9; color: var(--ink-2); cursor: default; }
.btn.quiet { background: #ececf0; color: var(--ink); }
.btn.quiet:hover { background: #e0e0e6; }
.row { display: flex; flex-wrap: wrap; gap: .5em; align-items: center; }

/* IPv6 */
.groups { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px; }
.groups button { min-height: 2.75rem; font: 600 1.05em var(--mono); background: #ececf0; border-radius: 6px; transition: background-color .2s, color .2s; }
.groups button:hover { background: #dedee5; }
.groups button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.big-addr { font: 600 clamp(1em, 2.1cqi, 1.45em)/1.35 var(--mono); overflow-wrap: anywhere; padding: .7em .8em; background: var(--tint); border-radius: 10px; }
.deliver { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .3em; }
.deliver li { display: grid; justify-items: center; gap: .2em; padding: .6em .1em; background: #f0f0f3; border-radius: 8px; font-weight: 500; transition: background-color .3s, color .3s, box-shadow .3s; }
.deliver li.grp { box-shadow: inset 0 0 0 1.5px var(--accent); }
.deliver li.on { background: var(--accent); color: #fff; }
.deliver small { font-size: .85em; font-weight: 400; }
.deliver .icon { width: 1.1em; height: 1.1em; stroke-width: 2.5; visibility: hidden; }
.deliver li.on .icon { visibility: visible; }
.cells { display: grid; grid-template-columns: repeat(32, minmax(0, 1fr)); gap: 1px; }
.cells i { aspect-ratio: 1; background: #dcdce2; border-radius: 1px; }
.cells i.n { background: var(--accent); }
.bignum { font: 600 1.05em/1.35 var(--mono); overflow-wrap: anywhere; }

/* Quiz */
.qr { display: grid; justify-items: center; gap: .7em; }
.qr img { width: min(100%, 24cqi); min-width: min(100%, 13rem); height: auto; aspect-ratio: 1; border: 1px solid var(--hair); border-radius: 12px; }
.qr a, .link { font-weight: 600; color: var(--accent); text-decoration: underline; text-underline-offset: .18em; text-decoration-thickness: 1.5px; min-height: 2.75rem; display: inline-flex; align-items: center; }
.pg > .qr img { width: min(100%, 12rem); }
.quiz-grid { display: grid; gap: 4px; }
.quiz-grid li { display: grid; grid-template-columns: 2em repeat(4, minmax(0, 1fr)); gap: 4px; align-items: center; font-variant-numeric: tabular-nums; }
.quiz-grid b { font: 500 .9em/1.7 var(--mono); text-align: center; background: #ececf0; border-radius: 4px; }

@container (min-width: 56rem) and (max-width: 72rem) {
  .pg { gap: .8em; padding-top: 2.4cqi; padding-bottom: 1.2cqi; }
  .fig { gap: .7em; }
  .hdr .tight .l { display: none; }
  .hdr .tight .s { display: inline; }
}

/* Opening cover */
.fly { position: fixed; z-index: 30; pointer-events: none; }
.fly-hinge { position: absolute; inset: 0; transform-origin: left center; transform-style: preserve-3d; will-change: transform; }
.fly-side { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 3px 7px 7px 3px; }
.fly-side.inner { transform: rotateY(180deg); background: var(--page); border-radius: 0 6px 6px 0; box-shadow: inset 34px 0 34px -30px rgb(20 20 30 / .2); }
.fly .cover { position: absolute; inset: 0; width: 100%; height: 100%; max-height: none; aspect-ratio: auto; transform: none; }
.fly .cover-face { container-type: size; }
.nb { white-space: nowrap; }

/* Small screens */
@media (max-width: 1099px), (max-height: 639px) {
  :root { --bar: 3rem; --nav: 3.75rem; }
  .stage { padding: 0; }
  .reader-bar { grid-template-columns: auto minmax(0, 1fr) auto; }
  .bar-btn span { display: none; }
  .bar-btn { padding: 0 .5rem; min-width: 2.75rem; }
  .reader-title { text-align: center; }
  .reader-nav { gap: 0; grid-template-columns: auto minmax(0, 1fr) auto; background: var(--page); border-top: 1px solid var(--hair); }
  .ticks { justify-content: center; }
  .tick { width: min(2.75rem, 13vw); min-width: 2.75rem; }
  .tick::before { width: 1.75rem; }
  .nav-label { display: none; }
  .nav-next { padding: 0; justify-content: center; }
  .nav-btn { justify-content: center; padding: 0; }
  .pg { min-height: 0; padding-bottom: 1rem; }
  .pg + .pg { padding-top: .5rem; }
  .pg .folio { display: none; }
  .slide .pg:last-child .folio { display: flex; }
}
@media (max-width: 899px) {
  .library { display: block; padding-top: 2.25rem; }
  .lib-head { grid-template-columns: 1fr; gap: .75rem; margin-bottom: 2rem; }
  .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem 1.125rem; border: 0; padding: 0; }
  .cover { max-height: none; }
  .cover:hover, .cover.is-selected { transform: none; }
  .cover:hover .cover-face, .cover.is-selected .cover-face { box-shadow: 0 1px 2px rgb(20 20 30 / .18), 0 10px 22px -8px rgb(20 20 30 / .32); }
  .cover:active { transform: scale(.975); }
  .bit-row { grid-template-columns: 2.6em repeat(4, minmax(0, 1fr)); }
  .bit-row > span { grid-row: span 2; }
  .bit-row[aria-hidden] { display: none; }
  .bit { height: auto; min-height: 2.75rem; line-height: 1.1; }
  .bit::after { content: attr(data-p); display: block; font-size: max(.8em, .8125rem); font-weight: 500; }
  .shelf-aside { display: flex; align-items: center; color: var(--ink-2); font-size: 1rem; line-height: 1.4; text-wrap: pretty; }
  .lib-foot { display: none; }
}
@media (min-width: 640px) and (max-width: 899px) { .shelf { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (hover: none) { .keys { display: none; } }
@media (max-height: 760px) and (min-width: 900px) {
  .library { padding-top: 1.5rem; gap: 1rem; }
  .lib-head h1 { font-size: clamp(2.25rem, 4.2vw, 3.5rem); }
  .cover { max-height: 50dvh; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .cover:hover, .cover.is-selected { transform: none; }
}
@media (forced-colors: active) {
  .bit[aria-pressed="true"], .seg button[aria-pressed="true"], .hdr button[aria-pressed="true"] { outline: 2px solid Highlight; }
}
