:root {
  color-scheme: dark;
  --ink: #171816;
  --ink-soft: #1d1e1b;
  --ink-raised: #242520;
  --paper: #f1eee5;
  --paper-muted: #b8b6ae;
  --brass: #b79a66;
  --brass-bright: #d2b57b;
  --line: rgba(231, 225, 210, .15);
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", Georgia, serif;
  --sans: "Avenir Next", "PingFang SC", "Hiragino Sans GB", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--ink); }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--paper);
  background:
    radial-gradient(circle at 72% -10%, rgba(183, 154, 102, .09), transparent 33rem),
    radial-gradient(circle at 6% 42%, rgba(255, 255, 255, .025), transparent 27rem),
    var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--brass); outline-offset: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.grain { position: fixed; inset: 0; z-index: 20; pointer-events: none; opacity: .18; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.92' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.15'/%3E%3C/svg%3E"); mix-blend-mode: soft-light; }

.masthead {
  width: min(1440px, calc(100% - 80px));
  margin: auto;
  padding: 34px 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 14px; }
.brand-mark { width: 31px; height: 31px; display: grid; align-content: center; gap: 3px; transform: rotate(-5deg); }
.brand-mark i { display: block; height: 1px; background: var(--brass); transform-origin: left; }
.brand-mark i:nth-child(2), .brand-mark i:nth-child(5) { width: 80%; }
.brand-mark i:nth-child(3), .brand-mark i:nth-child(4) { width: 92%; }
.brand strong { display: block; font: 600 22px/1 var(--serif); letter-spacing: .08em; }
.brand small { display: block; margin-top: 6px; color: var(--brass); font-size: 8px; letter-spacing: .28em; }

.upload-trigger, .primary-button {
  border: 1px solid var(--brass);
  border-radius: 999px;
  color: #171816;
  background: var(--brass);
  cursor: pointer;
  transition: background .2s, color .2s, transform .2s, box-shadow .2s;
}
.upload-trigger { display: flex; align-items: center; gap: 9px; padding: 10px 18px; font-weight: 600; font-size: 13px; }
.upload-trigger svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.upload-trigger:hover, .primary-button:hover { background: var(--brass-bright); box-shadow: 0 8px 30px rgba(183, 154, 102, .15); transform: translateY(-1px); }

main { width: min(1440px, calc(100% - 80px)); margin: auto; }
.intro { padding: clamp(68px, 9vw, 132px) 0 clamp(52px, 6vw, 88px); }
.eyebrow { margin: 0 0 17px; color: var(--brass); font-size: 10px; font-weight: 600; letter-spacing: .25em; }
.intro-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(240px, .7fr); align-items: end; gap: 54px; }
.intro h1 { margin: 0; font: 400 clamp(42px, 6vw, 88px)/1.08 var(--serif); letter-spacing: -.035em; }
.intro h1 em { color: var(--brass); font-style: normal; white-space: nowrap; }
.intro-row > p { max-width: 340px; margin: 0 0 8px; color: var(--paper-muted); font-size: 13px; line-height: 1.9; }

.catalogue { min-height: 45vh; }
.catalogue-tools { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 0 0 18px; border-bottom: 1px solid var(--line); }
.search-box { width: min(360px, 100%); display: flex; align-items: center; gap: 10px; }
.search-box svg { width: 18px; flex: 0 0 auto; fill: none; stroke: var(--paper-muted); stroke-width: 1.5; }
.search-box input { width: 100%; padding: 8px 0; border: 0; outline: 0; color: var(--paper); background: transparent; font-size: 14px; }
.search-box input::placeholder { color: #777872; }
#score-count { margin: 0; color: #85867f; font: 10px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; }

.score-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(24px, 2.6vw, 42px); padding: 38px 0 80px; }
.score-card { min-width: 0; opacity: 0; animation: rise .65s cubic-bezier(.2,.75,.3,1) forwards; animation-delay: var(--delay, 0ms); }
.score-link { display: block; color: inherit; text-decoration: none; }
.cover-wrap { position: relative; aspect-ratio: .73; overflow: hidden; border-radius: 2px; background: #eae7dd; box-shadow: 0 17px 42px rgba(0, 0, 0, .24); transition: transform .35s cubic-bezier(.2,.7,.2,1), box-shadow .35s; }
.cover-wrap::after { content: ""; position: absolute; inset: 0; border: 1px solid rgba(255,255,255,.18); pointer-events: none; }
.score-link:hover .cover-wrap { transform: translateY(-7px); box-shadow: 0 27px 60px rgba(0, 0, 0, .42); }
.cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top center; background: #eeece4; }
.cover:not([src]), .cover.is-broken { display: none; }
.paper-placeholder { position: absolute; inset: 0; padding: 18% 12%; color: #b4b0a4; background: linear-gradient(145deg,#f8f6ef,#e5e1d6); }
.cover-wrap.has-cover .paper-placeholder { display: none; }
.paper-placeholder span { display: block; margin-bottom: 20%; color: #6f6c65; text-align: center; font: 400 clamp(24px, 3vw, 42px)/1 var(--serif); letter-spacing: .15em; }
.paper-placeholder i { display: block; height: 1px; margin: 6% 0; background: #c7c2b7; box-shadow: 0 4px 0 #c7c2b7, 0 8px 0 #c7c2b7, 0 12px 0 #c7c2b7; }
.open-cue { position: absolute; left: 16px; right: 16px; bottom: 16px; z-index: 2; display: flex; justify-content: space-between; align-items: center; padding: 11px 14px; color: var(--paper); background: rgba(23,24,22,.84); backdrop-filter: blur(8px); font-size: 12px; opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .25s; }
.score-link:hover .open-cue, .score-link:focus-visible .open-cue { opacity: 1; transform: none; }
.score-meta { display: flex; justify-content: space-between; align-items: start; gap: 14px; padding: 19px 2px 0; }
.score-meta h2 { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 400 19px/1.35 var(--serif); letter-spacing: .02em; }
.score-meta p, .page-count { color: #7f8079; font-size: 10px; letter-spacing: .1em; }
.score-meta p { margin: 7px 0 0; }
.page-count { flex: none; margin-top: 5px; }

.state-panel { max-width: 540px; margin: 88px auto 120px; text-align: center; }
.state-glyph { width: 52px; height: 38px; display: grid; align-content: center; gap: 7px; margin: 0 auto 22px; }
.state-glyph span { height: 1px; background: var(--brass); transform: rotate(-4deg); }
.state-glyph span:nth-child(2) { width: 80%; justify-self: center; }
.state-panel h2 { margin: 0 0 10px; font: 400 28px/1.3 var(--serif); }
.state-panel p { margin: 0 auto; color: var(--paper-muted); font-size: 13px; line-height: 1.8; }
.text-action { margin-top: 22px; padding: 6px 0; border: 0; border-bottom: 1px solid var(--brass); color: var(--brass); background: none; cursor: pointer; }
.text-action span { display: inline-block; margin-left: 6px; transition: transform .2s; }
.text-action:hover span { transform: translateX(4px); }

footer { width: min(1440px, calc(100% - 80px)); margin: auto; padding: 24px 0 34px; display: flex; justify-content: space-between; border-top: 1px solid var(--line); color: #666761; font-size: 8px; letter-spacing: .22em; }

dialog { width: min(580px, calc(100% - 28px)); padding: 0; border: 1px solid rgba(183,154,102,.35); border-radius: 4px; color: var(--paper); background: #1b1c19; box-shadow: 0 30px 100px rgba(0,0,0,.7); }
dialog::backdrop { background: rgba(8,9,8,.78); backdrop-filter: blur(7px); }
dialog[open] { animation: dialog-in .25s ease-out; }
#upload-form { padding: 32px; }
.dialog-head { display: flex; justify-content: space-between; align-items: start; margin-bottom: 28px; }
.dialog-head h2 { margin: 0; font: 400 28px/1.2 var(--serif); }
.icon-button { width: 38px; height: 38px; padding: 9px; border: 1px solid var(--line); border-radius: 50%; color: var(--paper-muted); background: transparent; cursor: pointer; }
.icon-button svg { width: 100%; fill: none; stroke: currentColor; stroke-width: 1.5; }
.field { display: block; margin-top: 20px; }
.field > span, .field-caption > span { display: block; margin-bottom: 8px; color: #d7d3c8; font-size: 12px; }
.field input { width: 100%; padding: 12px 0; border: 0; border-bottom: 1px solid #45463f; outline: 0; color: var(--paper); background: transparent; }
.field input:focus { border-color: var(--brass); }
.file-section { margin-top: 25px; }
.field-caption { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; }
.field-caption small { color: #787972; font-size: 10px; }
.drop-zone { min-height: 124px; display: flex; flex-direction: column; justify-content: center; align-items: center; margin-top: 8px; border: 1px dashed #55564f; color: #b8b7b0; cursor: pointer; transition: border-color .2s, background .2s; }
.drop-zone:hover, .drop-zone.is-dragging { border-color: var(--brass); background: rgba(183,154,102,.05); }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-zone svg { width: 27px; margin-bottom: 8px; fill: none; stroke: var(--brass); stroke-width: 1.3; }
.drop-zone strong { color: var(--paper); font-size: 13px; }
.drop-zone span { margin-top: 4px; color: #767770; font-size: 10px; }
.file-list { max-height: 132px; margin: 12px 0 0; padding: 0; overflow: auto; list-style: none; counter-reset: pages; }
.file-list li { counter-increment: pages; display: grid; grid-template-columns: 25px minmax(0, 1fr) auto; align-items: center; gap: 9px; min-height: 36px; padding: 5px 8px; border-bottom: 1px solid rgba(255,255,255,.06); color: #bdbcb5; font-size: 11px; }
.file-list li::before { content: counter(pages, decimal-leading-zero); color: var(--brass); font-size: 9px; }
.file-list .file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-controls { display: flex; gap: 2px; }
.file-controls button { width: 25px; height: 25px; padding: 0; border: 0; color: #8d8e87; background: transparent; cursor: pointer; }
.file-controls button:hover:not(:disabled) { color: var(--brass); }
.file-controls button:disabled { opacity: .25; cursor: default; }
.form-status { min-height: 19px; margin: 16px 0 0; color: #c4a974; font-size: 11px; line-height: 1.5; }
.form-status.is-error { color: #dc8c7f; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }
.quiet-button, .primary-button { padding: 10px 17px; }
.quiet-button { border: 1px solid var(--line); border-radius: 999px; color: var(--paper-muted); background: transparent; cursor: pointer; }
.primary-button:disabled, .quiet-button:disabled { opacity: .45; cursor: wait; transform: none; }

@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }

@media (max-width: 1050px) { .score-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .masthead, main, footer { width: calc(100% - 36px); }
  .masthead { padding: 22px 0; }
  .upload-trigger { width: 42px; height: 42px; justify-content: center; padding: 0; font-size: 0; }
  .intro { padding: 68px 0 50px; }
  .intro-row { display: block; }
  .intro h1 { font-size: clamp(42px, 13vw, 68px); }
  .intro-row > p { margin-top: 26px; }
  .score-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 16px; padding-top: 28px; }
  .score-meta { display: block; padding-top: 12px; }
  .score-meta h2 { font-size: 16px; }
  .page-count { display: block; margin-top: 7px; }
  footer { display: none; }
  #upload-form { padding: 24px 20px; }
  .field-caption { display: block; }
  .field-caption small { display: block; margin-bottom: 11px; }
}
@media (max-width: 390px) { .score-grid { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; } }
