@font-face {
  font-family: Inter;
  src: url('https://media.opsu.cc/book-shelf/20261120-171559-c0ba50/inter.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  font-family: Inter, 'Noto Sans SC Variable', 'Microsoft YaHei UI', 'PingFang SC', sans-serif;
  color-scheme: dark;
  --page: #111;
  --panel: #191919;
  --text: #ededed;
  --line: #ffffff13;
  --button: #242424;
  --focus: #92b8ff;
  --scroll: #ffffff60;
  --plank-back: #282726;
  --plank-front: #444240;
  --plank-edge: #252423;
  --plank-edge-light: #ffffff38;
  --plank-shadow: #0008;
  --cover-frame: #292929;
  --cover-shadow: #bfa48e26;
  --contact-shadow: #000b;
  --button-shadow: #0003;
  background: var(--page);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

[data-theme='light'] {
  color-scheme: light;
  --page: #f6f5f2;
  --panel: #fff;
  --text: #222;
  --line: #00000018;
  --button: #e7e6e3;
  --focus: #3763bb;
  --scroll: #29272462;
  --plank-back: #aaa7a1;
  --plank-front: #c5c2bc;
  --plank-edge: #a09d97;
  --plank-edge-light: #fffd;
  --plank-shadow: #483f3329;
  --cover-frame: #eeedea;
  --cover-shadow: #5c4c3c29;
  --contact-shadow: #4d42304d;
  --button-shadow: #493f301a;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 290px; min-height: 100dvh; }
button, a { color: inherit; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 6px; }
.os-theme-shelf { --os-size: 8px; --os-handle-bg: var(--scroll); --os-handle-bg-hover: var(--scroll); --os-handle-bg-active: var(--scroll); --os-handle-border-radius: 9px; --os-padding-perpendicular: 2px; }

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--page);
  background: color-mix(in srgb, var(--page) 90%, transparent);
  backdrop-filter: blur(18px);
}
.top-inner, main { width: min(1192px, calc(100% - 64px)); margin-inline: auto; }
.top-inner { height: 56px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 14px; font-weight: 600; line-height: 1.35; }
.brand img { display: block; }
.brand span {
  padding: 6px 13px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--panel);
  box-shadow: inset 0 1px 0 #ffffff33, 0 3px 9px var(--button-shadow);
}
.surface-button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: linear-gradient(var(--button), var(--panel));
  box-shadow: inset 0 1px 1px #ffffff40, inset 0 -2px 4px #00000014, 0 5px 9px var(--button-shadow);
  font: inherit;
  cursor: pointer;
  transition: transform .16s ease, filter .16s ease, box-shadow .16s ease;
}
.surface-button:hover { filter: brightness(1.09); }
.surface-button:active { transform: translateY(2px); box-shadow: inset 0 1px 4px #0005; }
.theme, .reader-close { width: 36px; height: 36px; padding: 0; border-radius: 50%; font: 21px/1 'Segoe UI Symbol', sans-serif; }

main { padding-block: clamp(21px, 3vw, 36px) 28px; }
.shelf-viewport { overflow-x: auto; overflow-y: hidden; padding: 5px 0 27px; }
.shelves { min-width: 756px; display: grid; gap: clamp(12px, 1.6vw, 19px); }
.shelf {
  --surface-depth: clamp(20px, 2.5vw, 32px);
  --edge-height: clamp(5px, .6vw, 8px);
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  align-items: end;
  gap: clamp(9px, 1.25vw, 16px);
  padding: 0 7.7% calc(var(--surface-depth) * .68 + var(--edge-height));
}
.plank {
  position: absolute;
  z-index: -1;
  inset: auto 0 0;
  height: calc(var(--surface-depth) + var(--edge-height));
  filter: drop-shadow(0 10px 9px var(--plank-shadow));
}
.plank::before, .plank::after { content: ''; position: absolute; inset-inline: 0; display: block; }
.plank::before {
  height: var(--surface-depth);
  background: linear-gradient(112deg, #ffffff21, #ffffff00 57%, #00000012),
    linear-gradient(var(--plank-back), var(--plank-front));
  clip-path: polygon(5% 0, 95% 0, 100% 100%, 0 100%);
}
.plank::after {
  bottom: 0;
  height: var(--edge-height);
  border-radius: 0 0 5px 5px;
  border-top: 1px solid var(--plank-edge-light);
  background: linear-gradient(var(--plank-front), var(--plank-edge) 64%);
}
.book {
  --open: 0;
  position: relative;
  z-index: 2;
  min-width: 0;
  aspect-ratio: 584 / 800;
  border-radius: 7px;
  color: var(--text);
  text-decoration: none;
}
.book::before, .book::after {
  content: '';
  position: absolute;
  inset: 2px 1px 1px;
  border-radius: 3px 5px 5px 3px;
  pointer-events: none;
}
.book::before {
  border-right: 2px solid #a8a49d;
  background: repeating-linear-gradient(90deg, #faf8f3 0 2px, #dad6ce 2px 3px);
  box-shadow: 1px 2px 3px var(--contact-shadow), 0 8px 15px -6px var(--cover-shadow);
}
.book::after {
  background: linear-gradient(90deg, #ddd8cd, #faf8f2 85%, #e7e3da);
  box-shadow: 1px 0 2px #51463955;
  transform: perspective(1100px) rotateY(calc(-27deg * var(--open)));
}
.book::after, .cover {
  transform-origin: left center;
  transition: transform .38s cubic-bezier(.2,.7,.25,1);
}
.book:focus-visible { --open: 1; --cover-turn: perspective(1100px) rotateY(-42deg); z-index: 3; }
@media (any-hover: hover) {
  .book:hover { --open: 1; --cover-turn: perspective(1100px) rotateY(-42deg); z-index: 3; }
}
.cover {
  position: absolute;
  z-index: 1;
  inset: 0;
  overflow: hidden;
  border: 2px solid var(--cover-frame);
  border-radius: inherit;
  background: var(--cover-frame);
  box-shadow: 0 9px 19px -5px var(--cover-shadow), 0 0 0 1px var(--line);
  transform: var(--cover-turn, none);
}
.cover, .sample-preview {
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
}
.cover img, .sample-preview img {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  object-fit: scale-down;
}
.cover canvas, .sample-preview canvas { grid-area: 1 / 1; pointer-events: none; }
.sampled img { opacity: 0; }
.cover::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, #e8dedb30 0, #fff3 1.2%, #3c373324 2.4%, transparent 4.2%);
  box-shadow: inset 0 1px 0 #ffffff40;
}
.book-label {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: calc(100% + 3px);
  transform: translateX(-50%);
  width: max-content;
  padding: 2px 8px;
  pointer-events: none;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--panel);
  background: color-mix(in srgb, var(--panel) 90%, transparent);
  backdrop-filter: blur(14px);
  box-shadow: inset 0 1px 0 #ffffff22, 0 4px 12px var(--plank-shadow);
  opacity: var(--open);
  font-size: 12px;
  transition: opacity .18s;
}

html.reading { overflow: hidden; }
.reader {
  width: min(1360px, calc(100% - 44px));
  height: min(940px, calc(100dvh - 44px));
  max-width: none;
  max-height: none;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 26px;
  color: var(--text);
  background: var(--panel);
  box-shadow: 0 24px 90px var(--plank-shadow);
}
.reader[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.reader::backdrop { background: #10101075; backdrop-filter: blur(7px); }
.reader-bar { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.reader-bar h2 { margin: 0 auto 0 0; font-size: 15px; font-weight: 600; }
.reader-close { font-size: 24px; }
.original-link { display: inline-flex; align-items: center; padding-inline: 12px; font-size: 14px; text-decoration: none; white-space: nowrap; }
.reader iframe { display: block; width: 100%; height: 100%; min-height: 0; border: 0; background: #dbdee0; }
.reader [hidden] { display: none; }
.sample-preview { width: 100%; height: 100%; min-height: 0; padding: 18px; background: var(--page); }

@media (max-width: 640px) {
  .top-inner, main { width: calc(100% - 32px); }
  .top-inner { height: 56px; }
  .reader { width: 100%; height: 100dvh; margin: 0; border: 0; border-radius: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .cover, .book::after, .book-label, .surface-button { transition: none; }
}
