:root {
  --paper: #f5f4ee;
  --paper-warm: #eee6d6;
  --ink: #171717;
  --muted: #78746c;
  --line: rgba(23, 23, 23, 0.1);
  --shadow: 0 28px 80px rgba(30, 28, 24, 0.16);
  --serif: "Cormorant Garamond", "Playfair Display", Georgia, serif;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 8%, rgba(255, 255, 255, 0.9), transparent 28%),
    linear-gradient(180deg, #f8f8f3 0%, var(--paper) 48%, #ecebe4 100%);
  font-family: var(--sans);
  overflow-x: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
  color: inherit;
  background: none;
  cursor: pointer;
}

.site-shell {
  min-height: 100vh;
  padding: 34px 34px 76px;
}

main {
  min-height: calc(100vh - 110px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
}

.bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-items: center;
  padding: 18px 28px;
  color: #2a2925;
  font-size: 12px;
  letter-spacing: 0.08em;
  font-weight: 700;
  pointer-events: none;
}

.bottom-bar {
  bottom: 0;
}

.bottom-bar div {
  color: inherit;
  text-decoration: none;
  pointer-events: auto;
}

.bottom-bar div:nth-child(2) {
  text-align: center;
}

.bottom-bar div:nth-child(3) {
  text-align: right;
}

.hero {
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 0 0;
}

.hero-copy {
  max-width: 560px;
}

.eyebrow,
.page-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.18em;
  font-weight: 800;
}

h1,
h2 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.03em;
}

h1 {
  margin: 0;
  font-size: clamp(34px, 3vw, 50px);
  line-height: 0.92;
}

.site-nav {
  display: inline-flex;
  align-items: center;
  gap: clamp(22px, 3vw, 42px);
  font-size: 15px;
  font-weight: 760;
}

.site-nav a,
.site-nav button {
  position: relative;
  color: #24231f;
  text-decoration: none;
  white-space: nowrap;
  font: inherit;
  font-weight: inherit;
}

.site-nav a::after,
.site-nav button::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -5px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 180ms ease;
}

.site-nav a:hover::after,
.site-nav button:hover::after {
  transform: scaleX(1);
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 0;
}

.view-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(23, 23, 23, 0.07);
}

.view-switch-btn {
  min-height: 38px;
  padding: 0 15px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  transition: color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.view-switch-btn.active {
  color: #fffaf0;
  background: #171717;
  box-shadow: 0 10px 22px rgba(23, 23, 23, 0.14);
}

.library-top-btn,
.upload-top-btn,
.tool-btn,
.submit-btn {
  min-height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  color: #f8f4e9;
  background: #171717;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.library-top-btn:hover,
.upload-top-btn:hover,
.tool-btn:hover,
.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 34px rgba(23, 23, 23, 0.16);
}

.library-top-btn {
  color: #171717;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(23, 23, 23, 0.08);
}

.gallery-region {
  position: relative;
  height: auto;
  min-height: 0;
  min-width: 0;
  display: grid;
  grid-template-rows: 46px minmax(0, 1fr);
  align-items: center;
  margin-top: 0;
  padding-top: clamp(28px, 5vh, 62px);
  padding-bottom: clamp(22px, 4vh, 48px);
}

.gallery-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  align-self: start;
  margin: 0;
  padding-left: 2px;
  position: relative;
  z-index: 5;
}

.gallery-hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.book-gallery {
  width: calc(100vw - 68px);
  max-width: none;
  height: 342px;
  min-height: 0;
  display: flex;
  align-items: center;
  gap: 58px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 22px 14vw 44px;
  perspective: 1400px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  align-self: center;
}

.book-gallery.flat-layout {
  height: auto;
  min-height: 520px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  align-items: start;
  justify-items: stretch;
  gap: 2px;
  overflow: visible;
  padding: 18px 0 90px;
  perspective: none;
  scroll-snap-type: none;
}

.book-gallery::-webkit-scrollbar {
  height: 0;
}

.book-card {
  position: relative;
  width: 168px;
  height: 256px;
  flex: 0 0 auto;
  transform-style: preserve-3d;
  transform: rotateY(-28deg) rotateX(3deg) translateY(160px);
  opacity: 0;
  animation: flyIn 950ms ease-in-out forwards, floatBook 4.6s ease-in-out infinite;
  animation-delay: var(--delay), calc(var(--delay) + 950ms);
  transition: transform 180ms ease, filter 180ms ease;
  filter: drop-shadow(18px 28px 20px rgba(23, 23, 23, 0.2));
}

.book-card:hover {
  filter: drop-shadow(22px 32px 24px rgba(23, 23, 23, 0.24));
}

@media (hover: hover) and (pointer: fine) {
  .book-card:hover .book-model {
    animation: bookHover 220ms cubic-bezier(0.2, 0.9, 0.25, 1.15);
  }
}

.book-gallery.flat-layout .book-card {
  width: 100%;
  height: auto;
  aspect-ratio: 0.72;
  animation: flyGrid 360ms ease-in-out forwards;
  animation-delay: var(--delay);
  transform: translateY(18px) scale(0.98);
  filter: none;
}

.book-gallery.flat-layout .book-card:hover {
  transform: translateY(-3px) scale(1.01);
  filter: drop-shadow(0 12px 18px rgba(23, 23, 23, 0.14));
}

.book-gallery.flat-layout .book-model,
.book-gallery.flat-layout .book-cover {
  transform: none;
}

.book-gallery.flat-layout .book-pages,
.book-gallery.flat-layout .book-spine,
.book-gallery.flat-layout .book-bottom {
  display: none;
}

.book-gallery.flat-layout .book-cover {
  border-radius: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.book-model,
.book-cover,
.book-pages,
.book-spine,
.book-bottom {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  border-radius: 4px;
}

.book-cover {
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: var(--cover-ink);
  background: var(--cover);
  border: 1px solid rgba(255, 255, 255, 0.16);
  transform: translateZ(18px);
  overflow: hidden;
}

.book-cover::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 42px;
  height: 2px;
  background: var(--accent);
}

.book-title {
  font-family: var(--serif);
  font-size: 24px;
  line-height: 0.98;
  letter-spacing: -0.04em;
}

.book-author {
  margin-top: 10px;
  color: color-mix(in srgb, var(--cover-ink) 74%, transparent);
  font-size: 11px;
  line-height: 1.35;
  font-weight: 800;
}

.book-dot {
  width: 15px;
  height: 15px;
  border: 2px solid var(--accent);
  border-radius: 999px;
}

.book-pages {
  background:
    repeating-linear-gradient(0deg, #fffaf0 0 4px, #e6ddcc 4px 5px),
    #fffaf0;
  transform: translate3d(16px, 8px, -2px);
}

.book-spine {
  width: 34px;
  left: -17px;
  background: color-mix(in srgb, var(--cover) 72%, #000);
  transform: rotateY(90deg) translateZ(1px);
  transform-origin: right;
}

.book-bottom {
  top: auto;
  height: 22px;
  background: #e9dfcc;
  transform: rotateX(90deg) translateZ(-245px);
  transform-origin: bottom;
}

.gallery-away .book-card {
  opacity: 0;
  transition: opacity 180ms ease;
}

.gallery-away .book-card:hover {
  transform: rotateY(-28deg) rotateX(3deg);
}

.library-page {
  position: fixed;
  inset: 0;
  z-index: 48;
  padding: 88px 34px 42px;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.9), transparent 34%),
    rgba(245, 244, 238, 0.97);
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px);
  transition: opacity 260ms ease-in-out, transform 260ms ease-in-out;
}

.library-page.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.library-panel {
  width: min(1120px, 100%);
  max-height: calc(100vh - 130px);
  margin: 0 auto;
  overflow: auto;
  padding: clamp(22px, 4vw, 42px);
  border: 1px solid rgba(23, 23, 23, 0.08);
  border-radius: 28px;
  background: rgba(255, 253, 248, 0.9);
  box-shadow: var(--shadow);
  -webkit-overflow-scrolling: touch;
}

.library-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 360px);
  align-items: end;
  gap: 20px;
}

.library-head h2 {
  margin: 0;
  font-size: clamp(34px, 5vw, 66px);
  line-height: 0.95;
}

.library-head p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.library-search-label {
  color: var(--muted);
}

.library-search-label input {
  min-height: 46px;
  border-radius: 999px;
}

.tag-filter {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 22px 0 18px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.tag-filter::-webkit-scrollbar {
  height: 0;
}

.tag-chip {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(23, 23, 23, 0.06);
  font-size: 12px;
  font-weight: 850;
  scroll-snap-align: start;
}

.tag-chip.active {
  color: #fffaf0;
  background: #171717;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

.library-card {
  min-height: 190px;
  display: grid;
  align-content: space-between;
  gap: 18px;
  padding: 18px;
  border-radius: 8px;
  color: var(--cover-ink);
  background: var(--cover);
  text-align: left;
  box-shadow: 0 16px 36px rgba(23, 23, 23, 0.1);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.library-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 22px 44px rgba(23, 23, 23, 0.14);
}

.library-card h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 28px;
  line-height: 1.02;
  letter-spacing: 0;
}

.library-card-meta {
  color: color-mix(in srgb, var(--cover-ink) 75%, transparent);
  font-size: 12px;
  line-height: 1.45;
  font-weight: 850;
}

.library-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.library-card-tags span {
  padding: 4px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 24%, transparent);
  color: var(--cover-ink);
  font-size: 11px;
  font-weight: 850;
}

.library-empty {
  grid-column: 1 / -1;
  padding: 38px;
  border: 1px dashed rgba(23, 23, 23, 0.16);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
  font-weight: 800;
}

.about-page {
  position: fixed;
  inset: 0;
  z-index: 49;
  display: grid;
  place-items: center;
  padding: 86px 44px 42px;
  background:
    radial-gradient(circle at 50% 24%, rgba(255, 255, 255, 0.9), transparent 32%),
    rgba(245, 244, 238, 0.96);
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px);
  transition: opacity 320ms ease-in-out, transform 320ms ease-in-out;
}

.about-page.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.about-document {
  width: min(920px, 100%);
  max-height: calc(100vh - 128px);
  overflow: auto;
  padding: clamp(30px, 5vw, 68px);
  border: 1px solid rgba(23, 23, 23, 0.08);
  border-radius: 28px;
  background: rgba(255, 253, 248, 0.92);
  box-shadow: var(--shadow);
  -webkit-overflow-scrolling: touch;
}

.reader {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
  gap: 34px;
  padding: 86px 44px 42px;
  background:
    radial-gradient(circle at 50% 24%, rgba(255, 255, 255, 0.9), transparent 32%),
    rgba(245, 244, 238, 0.96);
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px);
  transition: opacity 320ms ease-in-out, transform 320ms ease-in-out;
}

.reader.active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.reader-back {
  position: fixed;
  top: 26px;
  left: 28px;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 14px 32px rgba(23, 23, 23, 0.12);
  font-size: 44px;
  line-height: 1;
  font-weight: 800;
}

.md-document {
  min-width: 0;
  width: min(920px, calc(100vw - 430px));
  max-width: 920px;
  height: calc(100vh - 128px);
  overflow: auto;
  margin: 0 auto;
  padding: clamp(30px, 5vw, 68px);
  border: 1px solid rgba(23, 23, 23, 0.08);
  border-radius: 28px;
  background: rgba(255, 253, 248, 0.92);
  box-shadow: var(--shadow);
  -webkit-overflow-scrolling: touch;
}

.md-document,
.reader-tools {
  position: relative;
  z-index: 2;
}

.md-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 28px;
  border-bottom: 1px solid rgba(23, 23, 23, 0.1);
}

.md-head-main {
  min-width: 0;
  --reader-title-align: clamp(5px, 0.75vw, 12px);
}

.md-head h2 {
  max-width: 820px;
  margin: 0 0 0 var(--reader-title-align);
  font-size: clamp(38px, 6vw, 78px);
  line-height: 0.94;
}

.case-author-line {
  margin: 16px 0 0 var(--reader-title-align);
  color: #2a2925;
  font-size: 18px;
  font-weight: 850;
  letter-spacing: 0.02em;
}

.case-author-line span {
  margin-left: 8px;
  color: var(--muted);
  font-size: 0.86em;
  font-weight: 750;
}

.case-updated-line {
  margin: 10px 0 0 var(--reader-title-align);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  font-weight: 750;
}

.md-motion {
  max-width: 720px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
  font-weight: 700;
}

.markdown-body {
  padding-top: 28px;
  color: #272520;
  font-family: Georgia, "Songti SC", serif;
  font-size: 18px;
  line-height: 1.84;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  font-family: var(--serif);
  color: var(--ink);
  line-height: 1.08;
}

.markdown-body h1 {
  margin: 0 0 18px;
  font-size: 42px;
}

.markdown-body h2 {
  margin: 34px 0 12px;
  font-size: 32px;
}

.markdown-body h3 {
  margin: 28px 0 10px;
  font-size: 24px;
}

.markdown-body p {
  margin: 0 0 1.15em;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 1.4em;
}

.markdown-body li + li {
  margin-top: 0.35em;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  overflow: hidden;
  border-radius: 14px;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
}

.markdown-body th,
.markdown-body td {
  padding: 11px 12px;
  border: 1px solid rgba(23, 23, 23, 0.1);
  text-align: left;
  vertical-align: top;
}

.markdown-body th {
  background: rgba(23, 23, 23, 0.06);
  font-weight: 800;
}

.markdown-body hr {
  height: 1px;
  border: 0;
  margin: 28px 0;
  background: rgba(23, 23, 23, 0.12);
}

.markdown-body blockquote {
  margin: 22px 0;
  padding-left: 18px;
  border-left: 3px solid rgba(23, 23, 23, 0.18);
  color: var(--muted);
}

.markdown-body code {
  padding: 0.12em 0.34em;
  border-radius: 6px;
  background: rgba(23, 23, 23, 0.06);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88em;
}

.reader-tools {
  align-self: center;
  display: grid;
  gap: 14px;
}

.download-actions {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.download-icon-btn {
  width: 44px;
  height: 44px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #171717;
  border: 1px solid #171717;
  color: #fffaf0;
  transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.download-icon-btn svg {
  width: 25px;
  height: 25px;
  display: block;
  fill: currentColor;
  stroke: none;
}

.settings-icon-btn svg {
  width: 22px;
  height: 22px;
}

.download-icon-btn:hover {
  transform: translateY(-2px);
  background: #2a2925;
  box-shadow: 0 14px 28px rgba(23, 23, 23, 0.16);
}

.case-tabs {
  display: grid;
  gap: 10px;
  max-height: 54vh;
  overflow: auto;
  padding-right: 4px;
  scroll-snap-type: y proximity;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.case-tabs::-webkit-scrollbar {
  width: 0;
}

.case-tab {
  min-height: 58px;
  padding: 12px 14px;
  border-radius: 18px;
  text-align: left;
  scroll-snap-align: start;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(23, 23, 23, 0.07);
  color: var(--muted);
  transition: transform 180ms ease, background 180ms ease;
}

.case-tab.active,
.case-tab:hover {
  color: var(--ink);
  background: #fffaf0;
  transform: translateY(-1px);
}

.case-tab strong {
  display: block;
  color: inherit;
  font-size: 14px;
}

.case-tab span {
  display: block;
  margin-top: 4px;
  font-size: 12px;
}

.upload-dialog {
  width: min(92vw, 560px);
  border: 0;
  padding: 0;
  background: transparent;
}

.upload-dialog::backdrop {
  background: rgba(23, 23, 23, 0.28);
  backdrop-filter: blur(8px);
}

.upload-card {
  display: grid;
  gap: 14px;
  padding: 24px;
  border-radius: 28px;
  background: #fbfaf4;
  box-shadow: var(--shadow);
}

.upload-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.upload-head h2 {
  margin: 4px 0 0;
  font-size: 42px;
}

.upload-inline-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.motion-picker {
  position: relative;
}

.motion-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 10;
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
  padding: 8px;
  border: 1px solid rgba(23, 23, 23, 0.08);
  border-radius: 18px;
  background: rgba(255, 253, 248, 0.98);
  box-shadow: 0 18px 42px rgba(23, 23, 23, 0.14);
  -webkit-overflow-scrolling: touch;
}

.motion-suggestions[hidden] {
  display: none;
}

.motion-suggestion {
  min-height: 42px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 12px;
  text-align: left;
  color: var(--ink);
  background: transparent;
}

.motion-suggestion:hover {
  background: rgba(23, 23, 23, 0.06);
}

.motion-suggestion span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 850;
}

.motion-suggestion small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.close-btn {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: rgba(23, 23, 23, 0.07);
  font-size: 24px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 14px;
  outline: none;
  color: var(--ink);
  background: #fffdf8;
}

textarea {
  min-height: 220px;
  resize: vertical;
  line-height: 1.6;
}

@keyframes flyIn {
  to {
    opacity: 1;
    transform: rotateY(-28deg) rotateX(3deg) translateY(0);
  }
}

@keyframes flyGrid {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes floatBook {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -10px;
  }
}

@keyframes bookHover {
  0% {
    transform: translateY(0) scale(1);
  }
  48% {
    transform: translateY(-12px) scale(1.02);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 1100px) {
  .md-document {
    width: min(720px, calc(100vw - 380px));
  }
}

@media (max-width: 760px) {
  .site-shell {
    padding: 22px 16px 92px;
  }

  main {
    min-height: calc(100vh - 112px);
  }

  .bottom-bar {
    padding-inline: 16px;
    font-size: 10px;
  }

  .hero {
    min-height: 0;
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 14px;
    padding-top: 12px;
  }

  .site-nav {
    width: 100%;
    gap: 22px;
    overflow-x: auto;
    padding: 2px 0 6px;
    font-size: 14px;
    -webkit-overflow-scrolling: touch;
  }

  .site-nav::-webkit-scrollbar {
    height: 0;
  }

  .hero-actions {
    width: 100%;
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .hero-actions::-webkit-scrollbar {
    height: 0;
  }

  .gallery-region {
    height: auto;
    min-height: 0;
    margin-top: 0;
    grid-template-rows: auto minmax(0, 1fr);
    padding-top: 34px;
    padding-bottom: 28px;
  }

  .gallery-toolbar {
    display: grid;
    gap: 10px;
    margin: 0;
  }

  .book-gallery {
    width: calc(100vw - 32px);
    gap: 42px;
    height: 286px;
    min-height: 0;
    padding: 18px 24vw 38px;
  }

  .book-gallery.flat-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2px;
    padding: 24px 0 90px;
  }

  .book-card {
    width: 142px;
    height: 218px;
  }

  .book-gallery.flat-layout .book-card {
    width: 100%;
    max-width: none;
    height: auto;
  }

  .library-page {
    padding: 78px 14px 18px;
  }

  .library-panel {
    max-height: calc(100vh - 96px);
    border-radius: 22px;
  }

  .library-head {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .library-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .library-card {
    min-height: 168px;
    padding: 14px;
  }

  .library-card h3 {
    font-size: 22px;
  }

  .about-page {
    padding: 78px 14px 18px;
  }

  .about-document {
    max-height: calc(100vh - 96px);
    padding: 28px 20px;
    border-radius: 22px;
  }

  .reader {
    grid-template-columns: 1fr;
    padding: 78px 14px 18px;
    overflow: auto;
  }

  .md-document {
    width: 100%;
    height: auto;
    min-height: 60vh;
    padding: 28px 20px;
    border-radius: 22px;
  }

  .md-head {
    display: grid;
    gap: 18px;
  }

  .md-head h2 {
    font-size: 38px;
  }

  .markdown-body {
    font-size: 16px;
  }

  .reader-tools {
    align-self: stretch;
  }

  .download-actions {
    justify-content: flex-start;
  }

  .case-tabs {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    max-height: none;
  }

  .case-tab {
    min-width: 180px;
  }

  .upload-inline-fields {
    grid-template-columns: 1fr;
  }

  .motion-suggestion {
    grid-template-columns: 1fr;
    gap: 3px;
  }
}
