:root {
  --default-spine-ratio: .085;
  color-scheme: dark;
  --bg: #110f19;
  --sidebar: #15121e;
  --panel: #1a1725;
  --raised: #211c2e;
  --line: #302940;
  --ink: #f6f3fb;
  --muted: #b0a6bf;
  --quiet: #958aa6;
  --violet: #b596ff;
  --purple: #a57aff;
  --mint: #57d5b1;
  --pink: #ef9fca;
  --gold: #ffcc78;
  --active: var(--violet);
  --done: var(--mint);
  --queue: var(--pink);
  font-family: "Segoe UI", system-ui, sans-serif;
  font-synthesis: none;
  background: var(--bg);
  color: var(--ink);
}

* { box-sizing: border-box; }
html { scrollbar-gutter: stable; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button { color: inherit; }
button:disabled { cursor: default; opacity: .65; }
a { color: inherit; text-decoration: none; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
::selection { background: #6946a2; color: #fff; }
.icon { width: 1.25em; height: 1.25em; flex: none; vertical-align: middle; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--muted); }
.boot { padding: 3rem; color: var(--muted); }

.shell { display: grid; grid-template-columns: 14rem minmax(0, 1fr); min-height: 100dvh; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 1.75rem 1.1rem 1.15rem;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .75rem; white-space: nowrap; }
.sidebar .brand { padding: 0 .35rem; }
.brand strong { font-size: 1.14rem; font-weight: 750; letter-spacing: -.035em; }
.brand strong em { color: var(--violet); font-style: normal; }
.brand-mark {
  width: 2.35rem;
  height: 2.35rem;
  display: grid;
  place-items: center;
  border-radius: .7rem;
  color: #191127;
  background: linear-gradient(145deg, #d4b8ff, #ab7df8);
  box-shadow: 0 4px 16px #9d71f62b;
}
.brand-mark .icon { width: 1.25rem; height: 1.25rem; }
.nav-group { margin-top: 3rem; }
.desktop-libraries { display: grid; gap: 1.1rem; }
.mobile-libraries { display: none; }
.library-owner { display: flex; align-items: center; gap: .65rem; padding: .35rem .45rem; border-radius: .45rem; }
.library-owner:hover { background: var(--raised); }
.library-owner[aria-current="true"] {
  color: #f6efff;
  background: #38294e;
  box-shadow: inset .22rem 0 var(--violet);
  padding-inline-start: .75rem;
}
.library-owner[aria-current="true"] .avatar { background: #c5a6ff; color: #281936; }
.library-owner > .icon { flex: none; margin-left: auto; color: var(--violet); }
.library-owner strong { overflow-wrap: anywhere; font-size: .94rem; }
.library-owner .avatar { width: 1.8rem; min-width: 1.8rem; height: 1.8rem; font-size: .72rem; }
.sidebar .nav-group { min-height: 0; overflow-y: auto; }
.shared-rating { color: var(--gold); white-space: nowrap; }
.open-volume .shared-rating { color: #87540e; }
.shared-status { font-weight: 600; }
.stack .sharing-choice, .profile-actions .sharing-choice { display: flex; align-items: flex-start; gap: .7rem; cursor: pointer; }
.sharing-choice input[type="checkbox"] { flex: none; width: 1.1rem; height: 1.1rem; margin: .15rem 0 0; accent-color: var(--violet); }
.sharing-choice span small { display: block; margin: .3rem 0 0; font-size: .83rem; font-weight: 400; line-height: 1.45; color: var(--muted); }
.nav-label { padding: 0 .7rem; color: var(--quiet); font-size: .74rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.sidebar nav { display: grid; gap: .35rem; margin-top: .7rem; }
.nav-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: var(--muted);
  padding: .75rem .8rem;
  border: 1px solid transparent;
  border-radius: .6rem;
  font-size: .92rem;
  font-weight: 650;
}
.nav-item:hover { background: #211b2e; color: var(--ink); }
.nav-item.current { background: #2b2040; color: #e0cbff; border-color: #443260; }
.nav-item.current .icon { color: var(--violet); }
.profile-button {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: .65rem;
  width: 100%;
  padding: .65rem;
  text-align: left;
  border-radius: .7rem;
  border: 1px solid var(--line);
  background: #1c1728;
}
.profile-button:hover { background: var(--raised); border-color: #57436f; }
.avatar {
  display: grid;
  place-items: center;
  min-width: 2.1rem;
  height: 2.1rem;
  padding: 0 .2rem;
  border-radius: 50%;
  background: #392653;
  color: #e2ceff;
  font-size: .74rem;
  font-weight: 750;
}
.profile-name { display: grid; min-width: 0; flex: 1; gap: .1rem; }
.profile-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .87rem; }
.profile-name small { color: var(--quiet); font-size: .74rem; }
.profile-button > .icon { color: var(--quiet); }

.content { width: 100%; max-width: 100rem; margin-inline: auto; padding: clamp(.85rem, 2.4dvh, 2rem) clamp(1.25rem, 3vw, 3.25rem) clamp(.75rem, 1.6dvh, 1.4rem); }
.primary, .secondary, .danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  min-height: 2.55rem;
  padding: .5rem .95rem;
  border: 1px solid transparent;
  border-radius: .52rem;
  font-size: .89rem;
  font-weight: 700;
}
.primary { color: #160c24; background: #bea1ff; border-color: #c9b1ff; }
.primary:hover { background: #d2baff; }
.secondary { background: #251e34; border-color: #453653; color: #e9dcfa; }
.secondary:hover { background: #332645; border-color: #635076; }
.danger { background: transparent; color: #ffabab; }
.danger:hover { background: #432732; }
.text-button {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .25rem .35rem;
  border: 0;
  border-radius: .3rem;
  color: var(--violet);
  background: transparent;
  font-weight: 650;
  font-size: .88rem;
}
.text-button:hover { color: #e8d5ff; background: #bd95ff17; }

.active { --status: var(--active); --status-bg: #302346; }
.waiting { --status: #e6bf81; --status-bg: #403322; }
.done { --status: var(--done); --status-bg: #1c3638; }
.queue { --status: var(--queue); --status-bg: #39243d; }
.library-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: .6rem; margin-top: .65rem; }
.library-heading p { color: var(--quiet); margin-top: .24rem; font-size: .85rem; }
.search-box {
  display: flex;
  align-items: center;
  gap: .45rem;
  width: min(17rem, 100%);
  min-height: 2.55rem;
  padding: 0 .75rem;
  border: 1px solid var(--line);
  border-radius: .55rem;
  background: var(--panel);
  color: var(--quiet);
}
.search-box input { appearance: none; width: 100%; padding: .45rem 0; border: 0; outline: none; background: transparent; color: var(--ink); font-size: .9rem; }
.search-box:focus-within { border-color: var(--violet); }
::placeholder { color: var(--quiet); opacity: 1; }
.filters { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem; margin: .65rem 0; }
.filters button { padding: .38rem .75rem; background: transparent; border: 1px solid transparent; border-radius: .4rem; color: var(--muted); font-size: .86rem; font-weight: 650; }
.filters button:hover { color: var(--ink); background: var(--raised); }
.filters button[aria-pressed="true"] { color: #e4d2ff; background: #2b2040; border-color: #443260; }
.sections { display: grid; gap: .5rem; }
.shelf { min-width: 0; border: 1px solid var(--line); border-radius: .75rem; background: var(--panel); overflow: hidden; }
.shelf-header { display: flex; align-items: center; gap: .6rem; padding: .56rem 1rem; background: #1d192a; }
.shelf-header h3 { font-weight: 700; font-size: 1.01rem; letter-spacing: -.015em; }
.status-dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--status); }
.shelf-count { padding: .08rem .42rem; border-radius: .36rem; color: var(--status); background: var(--status-bg); font-variant-numeric: tabular-nums; font-size: .77rem; }
.empty-state { color: var(--muted); padding: 1.2rem; font-size: .94rem; }
.table-wrap { overflow: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; border-top: 1px solid var(--line); }
th {
  padding: .4rem .5rem;
  color: var(--quiet);
  background: #181522;
  font-weight: 700;
  font-size: .69rem;
  letter-spacing: .09em;
  text-transform: uppercase;
}
th:first-child { padding-left: 1rem; }
td { padding: .38rem .5rem; }
tbody tr:hover { background: #201a2c; }
.cover-cell { width: 3.8rem; padding-left: 1rem; }
.cover-cell .cover { width: 2.3rem; }
.cover {
  position: relative;
  display: grid;
  place-items: center;
  width: 2.7rem;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border: 1px solid #4a3b5d;
  border-radius: .29rem;
  background: linear-gradient(140deg, #3c2a57, #261c37);
  color: var(--violet);
}
.cover img { position: absolute; width: 100%; height: 100%; object-fit: cover; }
.title-cell { min-width: 9rem; max-width: 19rem; width: 27%; }
.entry-name { display: block; padding: 0; border: 0; color: var(--ink); text-align: left; background: transparent; font-size: .93rem; font-weight: 750; line-height: 1.2; }
.entry-name:hover { color: var(--violet); }
.entry-meta { display: block; color: var(--muted); margin-top: .28rem; font-size: .78rem; line-height: 1.25; }
.sample { display: inline-block; color: var(--quiet); font-size: .72rem; margin-top: .18rem; }
.progress-cell { min-width: 10.25rem; width: 19%; }
.progress-numbers { display: flex; align-items: center; gap: .3rem; min-height: 1.6rem; color: var(--muted); font-size: .78rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.progress-numbers strong { margin-left: auto; color: var(--status); font-size: .83rem; }
.page-input {
  border: 1px solid #423657;
  border-radius: .3rem;
  background: #211a30;
  color: var(--ink);
  padding: .15rem .17rem;
  height: 1.55rem;
  width: 2.65rem;
  font-size: .78rem;
  text-align: center;
  appearance: textfield;
}
.page-input::-webkit-inner-spin-button, .page-input::-webkit-outer-spin-button { appearance: none; margin: 0; }
.finished-number { color: var(--ink); }
progress { display: block; margin-top: .4rem; width: 100%; height: .35rem; appearance: none; border: 0; border-radius: 99px; background: #322740; color: var(--status); }
progress::-webkit-progress-bar { background: #322740; border-radius: 99px; }
progress::-webkit-progress-value { background: var(--status); border-radius: 99px; }
progress::-moz-progress-bar { background: var(--status); border-radius: 99px; }
.rating-cell { width: 7.1rem; }
.stars { display: flex; gap: 0; white-space: nowrap; }
.star, .icon-button { display: inline-grid; place-items: center; padding: 0; color: var(--quiet); background: transparent; border: 0; border-radius: .3rem; }
.star { width: 1.13rem; min-height: 1.6rem; font-size: .75rem; }
.star.filled { color: var(--gold); }
.star.filled .icon { fill: currentColor; }
.star:hover { color: #ffe0a8; }
.shop-cell { min-width: 10.75rem; }
.retailers { display: grid; width: max-content; max-width: 100%; grid-template-columns: auto auto; gap: .26rem; }
.anime-links { display: flex; }
.shop { display: inline-flex; align-items: center; width: max-content; padding: .16rem .35rem; border: 1px solid #453751; border-radius: .27rem; background: #271f33; color: #d0bfdc; font-size: .72rem; line-height: 1.2; }
.shop:hover { color: #fff; border-color: currentColor; }
.shop-amazon { color: #f0c589; border-color: #61462d; background: #372a28; }
.shop-waterstones { color: #a9ded2; border-color: #39574f; background: #233533; }
.shop-forbidden { color: #d0b7f6; border-color: #513b67; background: #302441; }
.shop-travelling { color: #f0b8d7; border-color: #5e3e57; background: #362637; }
.status-cell { width: 7rem; }
.status-select { position: relative; display: inline-flex; align-items: center; }
.status-select select { width: 6.15rem; padding: .28rem 1.05rem .28rem .5rem; appearance: none; color: var(--status); background: var(--status-bg); border: 1px solid transparent; border-radius: .35rem; font-size: .78rem; font-weight: 650; }
.status-select select:hover { border-color: var(--status); }
.status-select option { background: var(--panel); color: var(--ink); }
.status-select .icon { position: absolute; right: .23rem; color: var(--status); width: .82rem; pointer-events: none; }
.edit-cell { width: 2.65rem; padding-right: .55rem; }
.icon-button { min-width: 1.8rem; min-height: 1.8rem; font-size: .85rem; }
.icon-button:hover { background: #b99bf522; color: var(--ink); }

.sign-in { min-height: 100dvh; display: grid; grid-template-columns: minmax(23rem, 39%) 1fr; }
.auth-panel { display: flex; flex-direction: column; min-height: 100%; padding: clamp(1.5rem, 4vw, 3rem); border-right: 1px solid var(--line); }
.auth-body { width: min(100%, 24rem); margin: auto; padding: 3rem 0; }
.auth-body h1 { font-size: clamp(2rem, 4vw, 3.1rem); letter-spacing: -.055em; line-height: 1; }
.auth-body p { margin-top: .85rem; color: var(--muted); line-height: 1.55; }
.auth-body .text-button { margin: .8rem -.25rem 0; }
.auth-art { background: linear-gradient(90deg, #130e1b 0%, #130e1b41 40%, transparent 70%), #180f23 url("./assets/night-panel.jpg") 87% center / auto 100% no-repeat; }
.stack { display: grid; gap: .85rem; margin-top: 1.5rem; }
.stack small { color: var(--muted); margin-top: -.5rem; }
.stack .primary { margin-top: .25rem; }

dialog { width: min(41rem, calc(100% - 2rem)); max-height: min(90dvh, 56rem); margin: auto; padding: 0; border: 1px solid #4a3a5b; border-radius: .9rem; color: var(--ink); background: var(--panel); box-shadow: 0 1rem 5rem #080610b5; overflow: hidden; }
dialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
dialog::backdrop { background: #0a0614ce; }
#profile-dialog { max-width: 29rem; }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1.15rem 1.3rem .95rem; border-bottom: 1px solid var(--line); }
.dialog-header h2 { font-size: 1.45rem; letter-spacing: -.04em; }
.dialog-header p { margin-top: .27rem; color: var(--muted); font-size: .88rem; }
.dialog-scroll { overflow: auto; padding: 1rem 1.3rem 1.25rem; }
.dialog-footer { display: flex; justify-content: space-between; gap: .5rem; padding: .75rem 1.3rem; border-top: 1px solid var(--line); background: #1d1928; }
.dialog-footer > div { display: flex; justify-content: flex-end; gap: .45rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem .8rem; }
.stack label, .form-grid label, .catalog label, .notes-field, #invite-result label { display: grid; gap: .3rem; color: #ddd3e9; font-size: .88rem; font-weight: 620; min-width: 0; }
.stack input, .form-grid input, .form-grid select, .lookup-row input, textarea, #invite-result input {
  width: 100%;
  padding: .5rem .62rem;
  border: 1px solid #443752;
  border-radius: .42rem;
  background: #15111f;
  color: var(--ink);
  font-size: .92rem;
  font-weight: 400;
}
.form-grid select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #b6a7c9 50%), linear-gradient(135deg, #b6a7c9 50%, transparent 50%); background-position: calc(100% - 13px) center, calc(100% - 9px) center; background-size: 4px 4px; background-repeat: no-repeat; }
.catalog { border: 1px solid #473757; border-radius: .55rem; background: #21192f; padding: .75rem; margin-bottom: 1rem; }
.lookup-row { display: flex; align-items: stretch; gap: .45rem; margin-top: .35rem; }
#catalog-results { color: var(--muted); font-size: .87rem; }
#catalog-results:not(:empty) { margin-top: .55rem; }
.catalog-matches { display: grid; max-height: 13rem; overflow: auto; gap: .25rem; }
.catalog-match { display: flex; text-align: left; align-items: center; gap: .55rem; padding: .3rem; background: #1a1426; border: 1px solid var(--line); border-radius: .4rem; }
.catalog-match:hover { border-color: var(--violet); }
.catalog-match .cover { width: 1.65rem; flex: none; }
.catalog-match strong { display: block; font-size: .86rem; }
.catalog-match small { color: var(--muted); }
.store-fields { margin-top: .82rem; color: var(--muted); }
.store-fields summary { cursor: pointer; color: var(--violet); font-size: .89rem; font-weight: 650; }
.store-fields p { font-size: .86rem; margin: .4rem 0 .5rem; }
.notes-field { margin-top: .8rem; }
.notes-field textarea { resize: vertical; min-height: 3.5rem; }
.form-error, .auth-body .form-error { color: #ffaeaf; margin-top: .55rem; font-size: .9rem; }
.profile-actions { display: grid; gap: 1.25rem; }
.site-version { color: var(--muted); font-variant-numeric: tabular-nums; }
.profile-actions h3 { font-size: 1.05rem; }
.profile-actions p { color: var(--muted); font-size: .9rem; margin: .35rem 0 .6rem; }
#invite-result:not(:empty) { display: flex; align-items: end; gap: .5rem; margin-top: .7rem; }
#invite-result label { flex: 1; }
.notice { position: fixed; z-index: 5; right: 1rem; bottom: 1rem; max-width: calc(100% - 2rem); padding: .7rem .95rem; border: 1px solid #5c4b7d; border-radius: .55rem; background: #29203c; color: #f3e8ff; box-shadow: 0 .2rem 1rem #07050c8c; font-size: .9rem; }
.notice.error { border-color: #9c555b; background: #452735; color: #ffd6d6; }

@media (max-width: 76rem) {
  .shell { grid-template-columns: 11.75rem minmax(0, 1fr); }
  .content { padding-inline: 1.35rem; }
}
@media (max-width: 62rem) {
  .desktop-libraries { display: none; }
  .mobile-libraries { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
  .viewing-library { display: inline-flex; align-items: center; gap: .35rem; color: var(--muted); font-size: .8rem; }
  .mobile-libraries select { max-width: min(12rem, 38vw); padding: .35rem; font-weight: 650; color: #f6efff; background: #38294e; border: 1px solid #8363a8; border-radius: .45rem; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: relative; height: auto; flex-direction: row; align-items: center; gap: .85rem; padding: .65rem 1.35rem; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav-group { margin: 0; }
  .nav-label { display: none; }
  .sidebar nav { display: flex; margin: 0; }
  .nav-item { padding: .5rem .65rem; gap: .4rem; }
  .profile-button { margin: 0 0 0 auto; width: auto; }
  .content { padding-top: 1.15rem; }
}
@media (max-width: 42rem) {
  .sidebar { padding-inline: .7rem; gap: .48rem; flex-wrap: wrap; }
  .sidebar #library-nav { order: 1; flex: 1 0 100%; }
  .mobile-libraries { justify-content: space-between; }
  .sidebar .brand { padding: 0; }
  .brand strong { font-size: .99rem; }
  .brand-mark { width: 1.9rem; height: 1.9rem; }
  .nav-item { padding: .43rem .48rem; font-size: .82rem; }
  .nav-item .icon, .profile-name, .profile-button > .icon { display: none; }
  .profile-button { padding: .24rem; }
  .avatar { min-width: 1.75rem; height: 1.75rem; }
  .content { padding: .75rem .75rem .65rem; }
  .library-heading { align-items: stretch; flex-direction: column; margin-top: .65rem; }
  .search-box { width: 100%; }
  .filters { margin: .7rem 0; }
  .filters button { padding-inline: .45rem; }
  .anime-page .filters button { padding-inline: .33rem; white-space: nowrap; }
  .anime-page .filters .shelf-count { padding-inline: .3rem; }
  .shelf-header { padding-inline: .65rem; }
  .table-wrap { overflow: visible; }
  table, tbody { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  tbody tr { display: grid; grid-template-columns: 2.3rem minmax(0, 1fr) auto; align-items: center; gap: .3rem .5rem; padding: .5rem .65rem; border-top: 1px solid var(--line); }
  .table-wrap tbody td { border: 0; padding: 0; width: auto; min-width: 0; max-width: none; }
  .cover-cell { grid-area: 1 / 1 / 3 / 2; align-self: start; }
  .table-wrap tbody .title-cell { grid-area: 1 / 2 / 2 / 4; padding-right: 2rem; }
  .edit-cell { grid-area: 1 / 3 / 2 / 4; justify-self: end; align-self: start; }
  .progress-cell { grid-area: 2 / 2 / 3 / 3; }
  .status-cell { grid-area: 2 / 3 / 3 / 4; }
  .rating-cell { grid-area: 3 / 2 / 4 / 3; }
  .star { width: 1.45rem; min-height: 1.75rem; }
  .shop-cell { grid-area: 4 / 2 / 5 / 4; }
  .retailers { display: flex; flex-wrap: wrap; }
  .entry-meta { display: inline; }
  .entry-meta + .sample { margin-left: .4rem; }
  .anime-page .shop-cell { grid-area: 3 / 3 / 4 / 4; justify-self: end; }
  .anime-page .retailers { justify-content: flex-end; }
  .sign-in { grid-template-columns: 1fr; background: var(--bg); }
  .auth-panel { min-height: 100dvh; border-right: 0; }
  .auth-art { display: none; }
  .dialog-header, .dialog-footer { padding-inline: .82rem; }
  .dialog-scroll { padding-inline: .82rem; }
}
@media (max-width: 25rem) {
  .form-grid { grid-template-columns: 1fr; }
  .dialog-footer .primary, .dialog-footer .secondary, .dialog-footer .danger { padding-inline: .4rem; font-size: .8rem; }
}

.library-actions { display: flex; align-items: center; justify-content: flex-end; gap: .6rem; }
.library-actions .primary { flex: none; }
.bookcase-page, .anime-page {
  display: flex;
  flex-direction: column;
  max-width: none;
  padding-inline: clamp(.75rem, 2vw, 2rem);
  padding-bottom: clamp(.75rem, 2vh, 1.5rem);
  background: radial-gradient(ellipse at top, #261a30 0, transparent 37rem);
}
.library-view-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .6rem; margin-bottom: .65rem; }
.case-layout select {
  width: auto; min-height: 2.25rem; padding: .25rem .6rem; border: 1px solid var(--line);
  border-radius: .5rem; background: var(--raised); color: var(--ink); font: inherit; font-size: .83rem;
}
.view-switch {
  display: flex;
  align-self: flex-start;
  gap: .2rem;
  padding: .2rem;
  border: 1px solid var(--line);
  border-radius: .65rem;
  background: var(--raised);
}
.view-switch button {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  min-height: 2.2rem;
  padding: .35rem .65rem;
  border: 1px solid transparent;
  border-radius: .45rem;
  background: transparent;
  color: var(--muted);
  font-size: .83rem;
  font-weight: 650;
}
.view-switch button:hover { color: var(--ink); }
.view-switch button[aria-pressed="true"] { background: #2b2040; border-color: #50406a; color: #eadbff; }
.content .library-view-bar + .library-heading { margin-top: .2rem; }
.library-heading h1 {
  font-family: Georgia, serif;
  font-size: clamp(2.3rem, 4.8vw, 3.35rem);
  font-weight: 500;
  letter-spacing: -.055em;
  line-height: 1.06;
}
.library-summary { display: flex; align-items: baseline; flex-wrap: wrap; gap: .25rem .8rem; margin-top: .4rem; }
.library-summary p { margin: 0; }
.resume-link { display: inline-flex; align-items: center; gap: .25rem; padding: .2rem 0; border: 0; background: transparent; color: var(--violet); font: inherit; font-size: .86rem; font-weight: 650; }
.resume-link:hover { text-decoration: underline; }
.resume-link .icon { width: 1em; height: 1em; }
.list-order { margin: 0 0 .65rem; }
.list-order label { display: inline-flex; align-items: center; gap: .55rem; color: var(--muted); font-size: .85rem; }
.list-order select { width: auto; max-width: 100%; padding: .3rem .45rem; font: inherit; }

.poster-wall { display: grid; align-content: start; gap: .65rem; }
.poster-section {
  min-width: 0;
  padding: .65rem clamp(.65rem, 1.6vw, 1.2rem) .78rem;
  border: 1px solid #362b42;
  border-radius: .7rem;
  background: radial-gradient(ellipse at top left, #32253dd1, transparent 38rem), #1a1424;
  box-shadow: inset 0 1px #ffffff0b, 0 .2rem .7rem #08050d38;
}
.poster-heading { display: flex; align-items: center; gap: .5rem; margin-bottom: .55rem; }
.poster-heading > .icon { color: var(--status); font-size: .85rem; }
.poster-heading h2 { font: 500 1.17rem/1.15 Georgia, serif; }
.poster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 7.5rem), 9rem));
  align-items: start;
  gap: .7rem;
}
.poster-card {
  display: grid;
  gap: .22rem;
  min-width: 0;
  width: 100%;
  text-align: left;
  border: 0;
  padding: 0;
  background: none;
  border-radius: .38rem;
  color: var(--ink);
}
.poster-frame {
  display: block;
  position: relative;
  padding: .18rem;
  border: 1px solid #78698c;
  border-radius: .4rem;
  background: linear-gradient(135deg,#735e8a,#272036 58%,#473750);
  box-shadow: 0 .25rem .65rem #08051091, inset 0 1px #ffffff26;
  transition: transform .18s ease-out, box-shadow .18s ease-out;
}
.poster-frame.done { border-color: #736348; background: linear-gradient(140deg,#8f7857,#2c2630 62%,#5d4a44); }
.poster-frame.queue .cover img { opacity: .59; }
.poster-frame.queue { border-color: #584760; }
.poster-frame .cover, .detail-poster .cover { width: 100%; aspect-ratio: 2 / 3; border: 0; border-radius: .23rem; }
.poster-frame .cover img { inset: 0; }
.poster-frame progress {
  position: absolute;
  margin: 0;
  inset: auto .28rem .3rem;
  width: calc(100% - .56rem);
  height: .28rem;
  box-shadow: 0 0 0 1px #241b2b;
  background: #221934e8;
}
.poster-frame progress::-webkit-progress-bar { background: #221934e8; }
.poster-bookmark {
  position: absolute;
  inset: .36rem .36rem auto auto;
  padding: .28rem;
  border-radius: .32rem;
  background: #211529ed;
  color: #ffd5eb;
  line-height: 1;
}
.poster-title {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow-wrap: anywhere;
  font-size: .83rem;
  font-weight: 690;
  line-height: 1.23;
}
.poster-caption { color: #c4afd9; font-size: .72rem; line-height: 1.25; font-variant-numeric: tabular-nums; }
.poster-rating { color: var(--gold); font-size: .77rem; letter-spacing: .04em; }
.poster-empty { color: var(--muted); font-size: .84rem; }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .poster-card:hover .poster-frame {
    transform: perspective(30rem) translateY(-.2rem) rotateX(4deg);
    box-shadow: 0 .42rem .95rem #080510c4, inset 0 1px #ffffff42;
  }
  .poster-card:hover .poster-frame.queue .cover img { opacity: .8; }
}
@media (min-width: 58rem) {
  .poster-wall { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .poster-wall > .active, .poster-wall > :only-child { grid-column: 1 / -1; }
}
@media (max-width: 42rem) {
  .poster-section { padding: .5rem .55rem .61rem; }
  .poster-heading { margin-bottom: .45rem; }
  .poster-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
}
@media (23rem <= width <= 58rem) {
  .poster-wall-paired { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .poster-wall-paired > .active { grid-column: 1 / -1; }
  .poster-wall-paired > :is(.done, .queue) .poster-grid { grid-template-columns: minmax(0, 7rem); }
}
@media (max-width: 22rem) {
  .poster-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.bookcase {
  display: grid;
  flex: none;
  width: 100%;
  grid-template-columns: minmax(0, 1fr);
  --shelf-count: 4;
  --spine-height: clamp(6rem, calc((100dvh - 29rem) / var(--shelf-count)), 36rem);
  --wood-frame: repeating-linear-gradient(92deg, #90634619 0 1px, #31222125 1px 3px, transparent 3px 9px),
    linear-gradient(90deg, #392522, #654336 35%, #4c302b 68%, #2b1c20);
  padding: .65rem;
  background: var(--wood-frame);
  border: 1px solid #795745;
  border-radius: .75rem;
  box-shadow: 0 1.1rem 3rem #06040a68, inset 0 1px #b18362b5, inset 0 -2px #1b111a;
}
.recommend-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,22rem),1fr)); gap:1rem; margin-block:1rem; }
.recommend-grid article { display:grid; grid-template-columns:clamp(4.5rem,10vw,7rem) minmax(0,1fr); gap:1rem; align-items:start; background:var(--panel); padding:1rem; border:1px solid var(--line); border-radius:.8rem; }
.recommend-grid .cover { width:100%; height:auto; aspect-ratio:2/3; }
.recommend-grid h3 { font:600 1.2rem/1.2 Georgia,serif; }
.recommend-grid article p { color:var(--muted); margin:.4rem 0; }
.recommend-grid .retailers { margin-block:.7rem; }
.set-tile-count { display:block; margin-top:.15rem; font:normal .78rem/1.25 system-ui,sans-serif; color:var(--muted); }
.saved-shops { margin-top: .35rem; font-size: .8rem; }
.set-view { min-width: 0; margin-top: .9rem; }
.set-panel, .set-body { min-width: 0; }
.set-panel { overflow-anchor: none; }
.set-panel[data-gallery] [data-all] { visibility: hidden; }
.set-panel:not([data-gallery]) .set-gallery { position: absolute; inset: 0 0 auto; }
.set-panel[data-moving] .set-info { overflow: clip; }
.set-panel[data-moving] .set-run { scroll-snap-type: none; overflow-anchor: none; }
.set-panel[data-moving] .set-gallery { z-index: 2; pointer-events: none; }
.set-panel[data-moving] .set-tile[data-travelling] { z-index: 3; }
.set-panel[data-moving] .book-slot { width: var(--flight-slot,var(--slot-width)); }
/* Only the pair lays its books out horizontally. A volume card stacks its label below. */
.set-panel[data-moving] .set-pair > .book-slot { flex-basis: var(--flight-slot,var(--slot-width)); }
@media (prefers-reduced-motion: no-preference) {
  .set-rack .book-slot { transition: width .16s ease-out, flex-basis .16s ease-out; }
}
.set-controls { display: flex; flex-wrap: wrap; align-items: start; gap: .55rem; margin-bottom: .7rem; }
.set-market { flex: 1 1 14rem; min-width: 0; }
.set-market summary { width: fit-content; padding: .45rem .65rem; border: 1px solid var(--line); border-radius: .5rem; color: var(--muted); cursor: pointer; font-size: .86rem; }
.set-market[open] > div { display: flex; flex-wrap: wrap; gap: .6rem 1rem; margin-top: .55rem; }
.set-choices { min-width: 0; border: 0; margin: 0; padding: 0; }
.set-choices legend { padding: 0 0 .2rem; color: var(--muted); font-size: .8rem; }
.set-choices label { position: relative; display: inline-block; cursor: pointer; }
.set-choices input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.set-choices span { display: inline-block; padding: .35rem .5rem; border: 1px solid var(--line); border-radius: .4rem; font-size: .82rem; }
.set-choices :checked + span { background: #39284c; color: #eadbff; border-color: #8960a8; }
.set-choices :focus-visible + span { outline: 2px solid var(--violet); }
.set-total label { display: grid; gap: .3rem; font-size: .82rem; color: var(--muted); }
.set-total input { min-width: 0; padding: .45rem; font: inherit; color: var(--ink); background: var(--raised); border: 1px solid var(--line); border-radius: .4rem; }
.set-panel h2 { font-family: Georgia, serif; font-size: 1.6rem; }
.set-panel .set-bay { min-width: 0; min-height: 0; display: block; }
.set-count { margin: .45rem 0; color: var(--muted); }
.set-count strong { color: var(--ink); }
.set-progress { display: block; width: min(24rem,100%); height: .4rem; margin: .5rem 0 .7rem; accent-color: var(--mint); }
.set-note,.set-total p,.set-paging span { font-size: .85rem; color: var(--muted); }
.set-deck {
  position: relative;
  --headroom: max(2rem, calc(var(--spine-height) * .36));
  --pitch: calc(var(--spine-height) + 4.4rem);
  min-width: 0;

  background-image: linear-gradient(to bottom, transparent var(--spine-height), #c59063 var(--spine-height),
    #79503b calc(var(--spine-height) + 2px), #432c28 calc(var(--spine-height) + .5rem),
    #170e16 calc(var(--spine-height) + .59rem), transparent calc(var(--spine-height) + .85rem));
  background-position: 0 var(--headroom);
  background-size: 100% var(--pitch);
}
.set-rack { padding: var(--headroom) .7rem .2rem; min-height: calc(var(--headroom) + var(--pitch) + .2rem); }
.set-bay { overflow: clip; }
.set-gallery { display: grid; grid-template-columns: repeat(auto-fill,minmax(min(100%, calc(var(--spine-height) * 1.17 + .6rem)),1fr)); grid-auto-rows: var(--pitch); }
.spines-together .set-gallery { grid-template-columns: repeat(auto-fill,minmax(min(100%,max(6rem,calc(var(--spine-height) * .52))),1fr)); }
.set-tile, .set-card { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.set-tile { align-self: start; position: relative; padding: 0 .25rem .2rem; color: var(--ink); border: 0; background: transparent; }
.set-pair { display: inline-flex; align-items: end; height: var(--spine-height); }
.set-tile-name { margin-top: .8rem; font: 600 .85rem/1.2 Georgia,serif; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.set-tile:is(:hover,:focus-visible) { z-index: 2; color: #f3e4ff; }
.set-tile:focus-visible .book-stage { filter: brightness(1.13); }
.set-tile:focus-visible .book-model { transform: var(--pulled-out); }
.spines-together .set-tile:focus-visible .set-rear .book-model { transform: translateY(-3%) rotateY(53deg); }
@media (hover:hover) {
  .set-tile:hover .book-stage { filter: brightness(1.13); }
  .set-tile:hover .book-model { transform: var(--pulled-out); }
  .spines-together .set-tile:hover .set-rear .book-model { transform: translateY(-3%) rotateY(53deg); }
}
.set-run { display: flex; align-items: start; overflow: auto hidden; scroll-snap-type: x proximity; scroll-padding-inline-start: .7rem; padding-bottom: .7rem; background-repeat: no-repeat; }
.set-card { position: relative; flex: none; width: max-content; padding-bottom: 1.7rem; scroll-snap-align: start; }
.set-card > small { position: absolute; bottom: 0; left: 0; right: 0; text-align: center; }
.set-card.set-current > small { color: var(--violet); font-weight: 750; }
.set-card:has(.book-slot:is(:hover,:focus-visible)) { z-index: 3; }
.set-run { padding-right: calc(var(--spine-height) * .65); }
.set-selection { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; margin-bottom: .6rem; }
.set-selection:empty { display: none; }
.set-selection .set-editions { flex-basis: auto; }
.set-card > .book-slot { flex: none; }
.set-card strong { margin-top: .65rem; }
.set-card.missing .book-stage { opacity: .72; }
.set-card.wanted .book-stage { opacity: .6; }
.set-card small, .set-card a, .set-card summary { font-size: .79rem; }
.set-card.owned small { color: var(--mint); }
.set-card.wanted small { color: var(--pink); }
.set-card .secondary { padding: .4rem; }
.set-info { margin-top: .85rem; }
.set-info .set-note { margin-bottom: .65rem; }
.set-editions { max-width: 100%; }
.set-editions a { display:block; }
.set-search-links { display:flex; flex-wrap:wrap; gap:.65rem; font-size:.84rem; margin-block:.6rem; }
.set-paging { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.set-total { margin-top: .9rem; border-top: 1px solid var(--line); padding-top: .7rem; }
.set-total summary { cursor: pointer; color: var(--violet); }
.set-total label { margin: .6rem 0; }
.set-total input { max-width: 8rem; }
.set-total p { margin-top: .4rem; }
.view-switch { flex-wrap: wrap; }
.section-stage { display: contents; }
.section-stage:has(> .bookcase) {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  position: relative;
}
.section-stage.sliding { overflow: clip; }
.outgoing-case { position: absolute; inset: 0 auto auto 0; pointer-events: none; }
.bookcase-page .filters button { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; }
.bookcase-page .filters .all { --status: #d3c5e8; --status-bg: #352d42; }
.case-shelf {
  min-height: calc((100dvh - var(--shelf-overhead, 16rem)) / var(--shelf-count));
  display: grid;
  grid-template-rows: auto 1fr auto;
  position: relative;
  isolation: isolate;
  background:
    linear-gradient(180deg, #140c17cd, transparent 31%, #a26b4025 86%, #bd865131),
    repeating-linear-gradient(96deg, #9c6c4714 0 1px, #2318202f 1px 3px, transparent 3px 12px),
    radial-gradient(ellipse at 48% 48%, #46303b, #231822 89%);
  box-shadow: inset 0 .35rem .8rem #100911, inset 0 0 1.6rem #100911ad;
}
.case-shelf::after, .shelf-ledge {
  display: block;
  height: .65rem;
  background: repeating-linear-gradient(0deg, #341f2200 0 2px, #2818254d 2px 3px),
    linear-gradient(180deg, #aa7650, #6e4635 33%, #56362d 70%, #362126);
  box-shadow: 0 .18rem .42rem #0b060ce6, inset 0 1px #d3975f73;
}
.case-shelf::after { content: ""; }
.shelf-ledge { position: absolute; inset-inline: 0; pointer-events: none; }
.case-label {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .48rem clamp(.65rem, 1.8vw, 1.1rem);
  color: #f2e4d8;
}
.case-label > .icon { color: var(--status); font-size: .81rem; }
.case-label h2 { font-family: Georgia, serif; font-weight: 500; font-size: 1.18rem; }
.case-label .shelf-count { margin-left: .1rem; }
.case-books {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  align-content: flex-end;
  gap: 1rem .15rem;
  padding: .35rem clamp(.7rem, 2.7vw, 1.6rem) 0;
}
.case-empty {
  color: #d0b8c9;
  padding: 1.15rem .1rem .9rem;
  font-size: .9rem;
}
.book-slot {
  --spine-width: calc(var(--spine-height) * var(--spine-ratio, var(--default-spine-ratio)));
  --slot-width: calc(var(--spine-height) * .49 + var(--spine-width) * .4);
  position: relative;
  display: block;
  flex: 0 0 var(--slot-width);
  width: var(--slot-width);
  max-width: 100%;
  height: var(--spine-height);
  padding: 0;
  border: 0;
  border-radius: .24rem;
  background: transparent;
}
.spine-palette-0 { --spine-color: #69509b; --spine-ink: #fbecff; }
.spine-palette-1 { --spine-color: #456058; --spine-ink: #eaf8ea; }
.spine-palette-2 { --spine-color: #9b6854; --spine-ink: #fff3e7; }
.spine-palette-3 { --spine-color: #d7b883; --spine-ink: #251922; }
.spine-palette-4 { --spine-color: #524676; --spine-ink: #f6ecff; }
.spine-palette-5 { --spine-color: #8a3f58; --spine-ink: #ffebf7; }
.book-stage {
  --book-width: 5.8rem;
  --book-depth: calc(var(--book-width) * 1.5 * var(--default-spine-ratio));
  position: relative;
  display: block;
  width: var(--book-width);
  aspect-ratio: 2 / 3;
  perspective: 28rem;
}
.book-stage::before {
  content: "";
  position: absolute;
  inset: auto -.72rem -.18rem -.35rem;
  height: .65rem;
  background: radial-gradient(ellipse, #080408df, transparent 71%);
}
.book-canvas {
  position: absolute;
  top: -22%;
  left: -14%;
  width: 128%;
  height: 122%;
  visibility: hidden;
  pointer-events: none;
}
.book-stage.is-rendered .book-canvas { visibility: visible; }
.book-stage.is-rendered .book-model,
.book-stage.is-rendered::before { visibility: hidden; }
.book-model {
  position: absolute;
  inset: 0;
  display: block;
  transform: rotateY(-12deg) rotateX(4deg);
  transform-origin: center bottom;
  transform-style: preserve-3d;
  transition: transform .24s cubic-bezier(.2,.65,.28,1);
}
.book-model .cover {
  width: 100%;
  height: 100%;
  grid-template-rows: auto auto;
  align-content: center;
  gap: .5rem;
  transform: translateZ(calc(var(--book-depth) / 2));
  border: 1px solid #f8eafa35;
  border-radius: .14rem .22rem .22rem .14rem;
  background: linear-gradient(105deg, #62466e, #362947 44%, #493554);
  color: #f1deff;
}
.book-model .cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #050309a8, #eee0ff38 3%, #1309164a 6%, transparent 11%);
  pointer-events: none;
}
.book-model .cover img { inset: 0; }
.cover-placeholder {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  max-width: 90%;
  overflow: hidden;
  font: 600 .84rem / 1.15 Georgia, serif;
  text-align: center;
  overflow-wrap: anywhere;
}
.book-pages {
  position: absolute;
  display: block;
  border: 1px solid #352329;
  border-radius: .13rem;
  backface-visibility: hidden;
}
.book-pages-side {
  inset: .1rem auto .1rem 100%;
  width: var(--book-depth);
  transform: translateZ(calc(var(--book-depth) / 2)) rotateY(90deg);
  transform-origin: left;
  background: repeating-linear-gradient(90deg, #d7c5ab 0 2px, #bca88f 2px 3px);
  box-shadow: inset 1px 0 #f2dec2a8, inset -2px 0 #44313c;
}
.book-pages-top {
  inset: auto .05rem 100%;
  height: var(--book-depth);
  transform: translateZ(calc(var(--book-depth) / 2)) rotateX(90deg);
  transform-origin: bottom;
  background: repeating-linear-gradient(0deg, #e3d1bd 0 2px, #bcaa9b 2px 3px);
}
.book-slot .book-stage {
  --book-width: calc(var(--spine-height) * 2 / 3);
  --book-depth: var(--spine-width);
  height: 100%;
  aspect-ratio: auto;
  perspective: calc(var(--spine-height) * 5);
  transform-origin: center bottom;
  pointer-events: none;
}
.book-slot .book-model {
  transform: rotateY(28deg);
  transition: transform .26s cubic-bezier(.2,.7,.22,1);
}
.case-books { overflow-x: clip; overflow-clip-margin: .4rem; }
.book-spine {
  position: absolute;
  inset: 0 100% 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .22rem;
  width: var(--book-depth);
  padding: .38rem .18rem .3rem;
  transform: translateZ(calc(var(--book-depth) / 2)) rotateY(-90deg);
  transform-origin: right;
  backface-visibility: hidden;
  border: 1px solid #2c182b;
  border-radius: .19rem .19rem .1rem .1rem;
  background:
    linear-gradient(90deg, #09060e78, transparent 13%, #fce7f52c 50%, #0b050f53 91%, #11081885),
    var(--spine-color);
  color: var(--spine-ink);
  box-shadow: inset 0 2px #ffebe132, inset 0 -2px #0d071d63;
}
.spine-original {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  border-radius: inherit;
}
.book-spine.illustrated { padding: 0; }
.spine-cover-art {
  display: block;
  flex: 0 0 21%;
  width: 100%;
  overflow: hidden;
  border: 1px solid #fff0dc6e;
  border-radius: .13rem;
  background: #241627;
}
.spine-cover-art:empty { display: none; }
.spine-cover-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 36%;
}
.book-spine.illustrated::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #14091d42, transparent 23%, #fff2 58%, #14091d45);
}
.spine-title {
  display: -webkit-box;
  flex: 1;
  min-height: 0;
  max-width: 100%;
  writing-mode: vertical-rl;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  text-align: left;
  font: 700 clamp(.78rem, calc(var(--spine-height) * .085), 2rem) / 1.1 Georgia, serif;
}
.spine-volume {
  width: 100%;
  border-top: 1px solid currentColor;
  padding-top: .23rem;
  font-size: clamp(.69rem, calc(var(--spine-height) * .075), 1.5rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.book-slot {
  --pulled-out: translateY(calc(var(--spine-height) * -.075)) translateZ(calc(var(--spine-height) * .12)) rotateX(-6deg) rotateY(9deg);
}
.queue .book-stage { opacity: .5; }
.book-slot:focus-visible { z-index: 2; }
.book-slot:focus-visible .book-stage { opacity: 1; }
.book-slot:focus-visible .book-model { transform: var(--pulled-out); }
@media (hover: hover) {
  .book-slot:hover { z-index: 3; }
  .book-slot:hover .book-stage { opacity: 1; }
  .book-slot:hover .book-model { transform: var(--pulled-out); }
}
#book-dialog { width: min(38rem, calc(100% - 2rem)); }
#book-title { overflow-wrap: anywhere; }
.book-detail-body { display: grid; grid-template-columns: minmax(0, 9.8rem) minmax(0, 1fr); gap: 1.5rem; }
.detail-cover { display: grid; align-content: start; justify-items: center; gap: .65rem; }
.detail-cover .book-stage { --book-width: min(100%, 8.5rem); margin-block: .3rem; }
.detail-cover { container-type: inline-size; }
.detail-cover .book-stage {
  --book-depth: calc(min(8.5rem, 100cqw) * 1.5 * var(--spine-ratio, var(--default-spine-ratio)));
  --spine-color: #665478;
  --spine-ink: #f4ebfa;
}
.detail-cover .book-model { transform: rotateY(12deg) rotateX(3deg); }
.detail-cover small { color: var(--muted); text-align: center; overflow-wrap: anywhere; }
.detail-poster { display: block; width: min(100%, 8.5rem); padding: .18rem; border: 1px solid #6e5a7e; border-radius: .55rem; background: #382b46; }
.episode-actions { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .6rem; }
.episode-actions button { min-height: 2.15rem; padding: .35rem .55rem; white-space: nowrap; }
.book-detail-info { display: grid; gap: 1rem; align-content: start; }
.purchase-date { display: block; margin-top: .35rem; }
.book-detail-info h3 { color: var(--muted); font-size: .88rem; font-weight: 650; margin: 0 0 .4rem; }
.detail-tracking { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .8rem .95rem; }
.detail-tracking > :nth-child(3) { grid-column: 1 / -1; }
.detail-progress .page-input { width: 3.35rem; height: 1.7rem; font-size: .87rem; }
.detail-progress .progress-numbers { font-size: .85rem; min-height: 1.7rem; }
.detail-progress progress { height: .42rem; }
.detail-status select { min-height: 1.7rem; }
.detail-rating .star { width: 1.8rem; min-height: 1.8rem; font-size: 1rem; }
.detail-retailers .retailers { display: flex; flex-wrap: wrap; width: auto; }
.detail-retailers .shop { font-size: .84rem; padding: .35rem .45rem; }
.book-notes { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.book-reference { justify-self: start; margin-left: -.35rem; }
.book-feedback { flex: 1; align-self: center; color: #d8bef9; font-size: .8rem; text-align: center; }
.book-feedback.error { color: #ffaeaf; }
.spine-field {
  min-width: 0;
  margin: 1rem 0 0;
  padding: .7rem;
  border: 1px solid var(--line);
  border-radius: .55rem;
}
.spine-field legend { color: var(--ink); padding-inline: .3rem; font-size: .88rem; font-weight: 650; }
.spine-upload { display: flex; gap: .7rem; align-items: flex-start; }
.spine-upload > :last-child { min-width: 0; }
.spine-upload label { display: block; font-size: .87rem; font-weight: 650; }
.spine-upload p { color: var(--muted); font-size: .83rem; margin-top: .2rem; }
.spine-upload input[type="file"] { width: 100%; margin-top: .55rem; color: var(--muted); font-size: .83rem; }
.spine-upload input::file-selector-button {
  margin-right: .55rem;
  padding: .3rem .5rem;
  border: 1px solid var(--line);
  border-radius: .35rem;
  color: var(--ink);
  background: #30243e;
  cursor: pointer;
}
.spine-preview { flex: 0 0 1.6rem; height: 5.5rem; }
.spine-preview img { width: 100%; height: 100%; object-fit: contain; border-radius: .15rem; }
.spine-status:empty { display: none; }
.spine-upload .spine-status.error { color: #ffaeaf; }
.spine-upload [data-action="remove-spine"] { display: block; margin-top: .4rem; }

@media (max-width: 62rem) {
  .shell { grid-template-rows: auto 1fr; }
  .bookcase { --spine-height: clamp(6rem, calc((100dvh - 31rem) / var(--shelf-count)), 24rem); }
}
@media (max-width: 42rem) {
  .library-actions { justify-content: stretch; }
  .library-actions .search-box { min-width: 0; }
  .bookcase { padding: .38rem; }
  .bookcase { --spine-height: clamp(6rem, calc((100dvh - 34rem) / var(--shelf-count)), 16rem); }
  .book-detail-body { grid-template-columns: minmax(0, 6rem) minmax(0, 1fr); gap: .8rem; }
  .detail-cover .book-stage { --book-width: calc(100% - .35rem); --book-depth: calc((100cqw - .35rem) * 1.5 * var(--spine-ratio, var(--default-spine-ratio))); }
  .detail-tracking { grid-template-columns: 1fr; gap: .65rem; }
  #episode-form .page-input { height: 2.25rem; font-size: 1rem; }
  .episode-actions button { min-height: 2.75rem; }
}
@media (prefers-reduced-motion: reduce) {
  .book-model, .book-slot .book-model { transition: none; }
}

/* The hit area stays on the shelf while the jacket swings out over adjacent volumes. */
.spines-together .case-books { column-gap: 0; }
.spines-together .book-slot {
  --spine-width: clamp(.6rem, calc(var(--spine-height) * var(--spine-ratio, .15)), calc(var(--spine-height) * .4));
  --slot-width: var(--spine-width);
  --pulled-out: translateX(calc(var(--spine-width) / 2 + var(--pull-shift, 0px))) translateY(-6%) scale(1.035) rotateX(-5deg) rotateY(24deg);
  border-radius: .1rem;
}
.spines-together .book-slot:not(:has(.spine-original)) { --spine-width: max(1.5rem, calc(var(--spine-height) * .15)); }
.spines-together .book-stage { perspective: none; }
.spines-together .book-stage::before { display: none; }
.spines-together .book-model {
  transform-origin: left bottom;
  transform: translateX(calc(var(--spine-width) / 2)) rotateY(90deg);
  transition: transform .29s cubic-bezier(.2,.72,.24,1);
}
.spines-together .book-spine { justify-content: center; overflow: hidden; gap: .18rem; }
.spines-together .spine-title {
  display: block; flex: 1; min-height: 0; max-height: 100%; writing-mode: vertical-rl;
  white-space: nowrap; text-overflow: ellipsis; text-align: center;
  font-size: clamp(.72rem, calc(var(--spine-height) * .08), 1.45rem);
}
.spines-together .long-title { white-space: normal; overflow-wrap: anywhere; font-size: clamp(.66rem, calc(var(--spine-height) * .057), 1.05rem); line-height: 1.08; }
.spines-together .spine-volume { flex: none; padding: .1rem 0 0; font-size: clamp(.6rem, calc(var(--spine-height) * .065), 1.1rem); }
.spines-together .wishlist-volume .book-stage { opacity: .55; }
.spines-together .book-slot:is(:focus-visible,.is-extracted) { z-index: 4; }
.spines-together .book-slot:is(:focus-visible,.is-extracted) .book-stage { opacity: 1; }
.spines-together .book-slot:is(:focus-visible,.is-extracted) .book-model { transform: var(--pulled-out); }
@media (hover: hover) {
  .spines-together .book-slot:hover { z-index: 5; }
  .spines-together .book-slot:hover .book-stage { opacity: 1; }
  .spines-together .book-slot:hover .book-model { transform: var(--pulled-out); }
}
@media (prefers-reduced-motion: reduce) {
  .spines-together .book-model { transition: none; }
}
.book-slot.book-lifted { opacity: 0; }
#book-dialog.open-volume {
  --volume-page-fraction: .5;
  --volume-width: min(54rem, calc(100vw - 2rem), calc(88dvh * 4 / 3));
  --paper: #f2e6ce;
  --paper-line: #aa8b6e65;
  --ink: #33252c;
  --muted: #695145;
  --quiet: #695145;
  --violet: #674185;
  color-scheme: light;
  width: var(--volume-width);
  height: calc(var(--volume-width) * .75);
  max-width: none;
  max-height: none;
  color: var(--ink);
  grid-template-rows: minmax(0, 1fr);
  overflow: visible;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.volume-paper {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
  overflow: hidden;
  border: 3px solid #593746;
  border-radius: .9rem .9rem .65rem .65rem;
  background: linear-gradient(90deg, #ead9ba, #f5ead5 5%, var(--paper) 47%, #f6ecd8 93%, #ead7b8);
  box-shadow: 0 3px #dbbf97, 0 6px #a68267, 0 10px #4d3041, 0 1.3rem 3.4rem #08050bca;
}
.volume-paper::after {
  content: "";
  position: absolute;
  z-index: 2;
  inset-block: 0;
  left: 50%;
  width: clamp(1rem, 4%, 2rem);
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, #b9967450 44%, #886a5380 50%, #bea17d45 58%, transparent);
  pointer-events: none;
}
.volume-watermark {
  position: absolute;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.volume-watermark img {
  position: absolute;
  right: 0;
  width: 52%;
  height: 100%;
  object-fit: cover;
  object-position: 63% 27%;
  opacity: .13;
  mask-image: radial-gradient(ellipse at 77% 37%, #000 13%, #0009 36%, transparent 76%);
  mix-blend-mode: multiply;
}
.volume-blurb .volume-watermark img {
  left: 0;
  right: auto;
  width: 58%;
  object-position: 37% 68%;
  opacity: .23;
  mask-image: radial-gradient(ellipse at 29% 74%, #000 13%, #000b 42%, transparent 78%);
}
.open-volume .dialog-header, .open-volume .dialog-footer {
  border-color: var(--paper-line);
  background: transparent;
}
.volume-paper > :is(.dialog-header, .dialog-scroll, .dialog-footer) { position: relative; z-index: 1; }
.open-volume .dialog-header h2 {
  font: 600 clamp(1.55rem, 3vw, 2.2rem)/1.06 Georgia, serif;
  letter-spacing: -.035em;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.open-volume .dialog-scroll {
  min-height: 0;
  overflow: clip;
  background: transparent;
}
.open-volume .book-detail-body {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(1.75rem, 6vw, 4.6rem);
  padding: clamp(1.2rem, 3vw, 2rem);
}
.open-volume .detail-tracking { grid-template-columns: minmax(0, 1fr); gap: .85rem; }
.volume-title-page { display: grid; align-content: center; justify-items: center; gap: .8rem; text-align: center; }
.paper-cover {
  width: min(67%, 10rem);
  padding: .24rem;
  border: 1px solid #86654b7a;
  border-radius: .34rem;
  background: #e8d4b7;
  box-shadow: 0 .3rem .65rem #694a4239;
}
.paper-cover .cover { width: 100%; border-color: #784e6952; }
.volume-imprint { display: grid; gap: .9rem; margin: 0; }
.volume-imprint dt {
  margin-bottom: .28rem;
  color: #745e4b;
  font-size: .68rem;
  font-weight: 650;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.volume-imprint dd { margin: 0; font: 500 1.15rem/1.25 Georgia, serif; overflow-wrap: anywhere; }
.volume-title-page .detail-sample { font-size: .76rem; color: var(--muted); }
.volume-blurb .book-detail-body { grid-template-rows: minmax(0, 1fr); }
.blurb-content {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.blurb-content h3 { margin-bottom: .7rem; font: 600 1.45rem/1.15 Georgia, serif; }
.blurb-copy { min-height: 0; overflow: clip; }
.blurb-copy p { font: 400 1.05rem/1.6 Georgia, serif; white-space: pre-line; }
.blurb-source a { margin-top: .5rem; padding-inline: 0; }
.volume-notes-link { justify-self: start; }
.open-volume .dialog-footer { flex-wrap: wrap; }
.volume-pagination, .catalog-paging {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: .55rem;
}
.volume-pagination { flex: 0 0 100%; }
.volume-pagination button:first-child, .catalog-paging button:first-child { justify-self: start; }
.volume-pagination button:last-child, .catalog-paging button:last-child { justify-self: end; }
.volume-pagination button { min-height: 1.9rem; padding-block: .25rem; }
.volume-page-number, .catalog-paging span { color: var(--muted); font: .9rem Georgia, serif; }
.volume-editing .dialog-scroll {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  padding-block: .8rem;
}
.volume-editing #entry-form { display: contents; }
.volume-editing .dialog-scroll > .catalog, .volume-editor-section, .volume-editing .form-error { flex: none; margin: 0; }
.volume-editor-section h3 { margin-bottom: .35rem; font: 600 1.1rem Georgia, serif; }
.volume-editor-section .form-grid { row-gap: .45rem; }
.volume-editor-section .notes-field, .volume-editor-section .spine-field { grid-column: 1 / -1; margin: 0; }
.carlsen-field { grid-column: 1 / -1; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: .55rem; margin-block: .65rem; }
.open-volume .carlsen-field { margin: 0; border-color: var(--paper-line); background: #f8ecd7; }
.carlsen-field strong { font-size: .88rem; }
.carlsen-status { margin-block: .2rem .35rem; color: var(--muted); font-size: .85rem; }
.carlsen-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .65rem; }
.carlsen-actions .secondary, .carlsen-actions .text-button { min-height: 1.9rem; padding-block: .22rem; font-size: .85rem; }
.carlsen-actions select { max-width: 100%; }
.volume-editor-section textarea { height: 4.5rem; resize: none; }
.volume-editor-catalog .lookup-row input { min-width: 0; }
.volume-editor-catalog .catalog-match span { min-width: 0; overflow-wrap: anywhere; }
.volume-editor-catalog .catalog-match :is(strong, small) {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.volume-editing .spine-upload input::file-selector-button { background: #e9d9c1; }
.volume-editor-catalog .catalog-matches { overflow: clip; }
.volume-draft #catalog-form { border: 0; padding: .4rem 0; background: transparent; }
.volume-draft .catalog-match { width: 100%; gap: .8rem; padding: .55rem; }
.volume-draft .catalog-match .cover { width: clamp(2.5rem, 9dvh, 4.75rem); }
.volume-draft .catalog-match :is(strong, small) { -webkit-line-clamp: 4; }
.volume-draft .catalog-match strong { margin-bottom: .25rem; font: 600 1.08rem/1.2 Georgia, serif; }
@media (min-width: 41rem) and (min-height: 31rem) {
  .volume-draft #catalog-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto 1fr;
    column-gap: clamp(2rem, 5vw, 4rem);
    align-items: start;
  }
  .volume-draft .lookup-row { grid-column: 1; }
  .volume-draft #catalog-results { grid-column: 2; grid-row: 1 / 3; margin: 0; }
}
.catalog-paging { margin-top: .5rem; }
.open-volume .detail-progress {
  --status: #603790;
  --status-bg: #e8d7ec;
}
.open-volume .detail-progress.done { --status: #276952; --status-bg: #d9e6d2; }
.open-volume .detail-status .done { --status: #276952; --status-bg: #d9e6d2; }
.open-volume .detail-status .active { --status: #603790; --status-bg: #e8d7ec; }
.open-volume .detail-status .waiting { --status: #704d18; --status-bg: #efdfbc; }
.open-volume .detail-status .queue { --status: #81395e; --status-bg: #f0d8df; }
.open-volume .detail-progress progress,
.open-volume .detail-progress progress::-webkit-progress-bar { background: #d7c5aa; }
.open-volume .detail-rating .star.filled { color: #87540e; }
.open-volume .page-input,
.open-volume .form-grid input, .open-volume .form-grid select,
.open-volume textarea, .open-volume .catalog input {
  color-scheme: light;
  color: var(--ink);
  background: #fff8eb;
  border-color: #ad8e76a0;
}
.open-volume :is(.form-grid label, .catalog label, .notes-field) { color: var(--ink); }
.open-volume .form-grid select { appearance: auto; }
.open-volume .status-select option { background: #fff8eb; color: var(--ink); }
.open-volume .secondary { color: #553b57; background: #dfcce3; border-color: #ab85ad; }
.open-volume .secondary:hover { background: #d9bddf; }
.open-volume .primary { background: #684486; color: #fff5ff; border-color: #60417e; }
.open-volume .primary:hover { background: #593675; }
.open-volume .danger, .open-volume .book-feedback.error, .open-volume .form-error { color: #8e2638; }
.open-volume .text-button, .open-volume .book-feedback { color: #624074; }
.open-volume .catalog, .open-volume .spine-field { background: #f8ecd7; border-color: var(--paper-line); }
.open-volume .catalog-match { color: var(--ink); background: #f8ecd7; border-color: var(--paper-line); }
.open-volume .catalog-match:hover { background: #ead8c1; }
.open-volume .catalog-match small { color: var(--muted); }
.open-volume.volume-editing .form-grid { column-gap: clamp(.65rem, 3vw, 2.5rem); }
@media (min-width: 41rem) {
  .volume-editor-section .form-grid:has([name="progress"]) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.open-volume.volume-locked > :not(.volume-flight, .volume-leaf) { pointer-events: none; }
.volume-concealed .volume-paper { clip-path: inset(50%); }
.volume-flight {
  position: fixed;
  display: block;
  z-index: 30;
  border-radius: .4rem;
  transform-origin: top left;
  transform-style: preserve-3d;
  background: linear-gradient(90deg, #f5e5c9, #d2b895);
  box-shadow: -.26rem .16rem #654958, -.42rem .26rem #c1a78f, 0 .5rem 1.7rem #09060dc0;
  pointer-events: none;
}
.volume-flight .cover {
  width: 100%;
  height: 100%;
  display: grid;
  align-content: center;
  gap: .45rem;
  border: 0;
  border-radius: inherit;
  backface-visibility: hidden;
  transform: translateZ(.1px);
}
.volume-flight .cover img { inset: 0; object-fit: cover; }
.volume-leaf {
  position: absolute;
  inset: 0 50% 0 0;
  border: 1px solid #c4a481;
  border-radius: .75rem 0 0 .75rem;
  transform-origin: right center;
  background: linear-gradient(90deg, #e4cda7, #fff2da 18%, #f2e2c6 91%, #b89371);
  box-shadow: 0 0 1.35rem #48322559;
  opacity: 0;
  pointer-events: none;
}
@media (max-width: 40rem) {
  #book-dialog.open-volume {
    --volume-page-fraction: 1;
    --volume-width: min(calc(100vw - 1.15rem), calc(88dvh * .6));
    height: calc(var(--volume-width) / .6);
  }
  .volume-paper { background: linear-gradient(90deg, #d9c3a3, #f4e7cf 4%, #f8edd7 95%, #e8d3af); }
  .volume-paper::after { left: 0; width: .9rem; transform: none; background: linear-gradient(90deg, #886a5358, transparent); }
  .volume-watermark img { width: 100%; }
  .volume-blurb .volume-watermark img { width: 100%; opacity: .13; }
  .open-volume .book-detail-body {
    grid-template-columns: minmax(0, clamp(4.5rem, 24vw, 6rem)) minmax(0, 1fr);
    align-content: start;
    gap: .65rem;
    padding: .75rem .85rem;
  }
  .open-volume.volume-blurb .book-detail-body { grid-template-columns: minmax(0, 1fr); }
  .volume-title-page {
    grid-template-columns: minmax(0, 1fr);
    gap: .5rem;
    align-content: start;
  }
  .paper-cover { width: 100%; }
  .volume-blurb .volume-title-page { display: none; }
  .volume-imprint { gap: .4rem; }
  .volume-imprint dt { margin-bottom: .15rem; }
  .volume-imprint dd { font-size: .88rem; }
  .open-volume .volume-leaf { inset-inline-end: 0; }
  .open-volume .detail-retailers .shop { font-size: .77rem; }
  .open-volume .book-feedback { order: 3; flex: 0 0 100%; }
  .open-volume .detail-tracking, .open-volume .book-detail-info { gap: .6rem; }
  .open-volume.volume-editing .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 22rem) {
  .open-volume .book-detail-body { padding-block: .55rem; }
  .open-volume.volume-editing .dialog-scroll { padding-block: .6rem; }
  .open-volume .detail-tracking, .open-volume .book-detail-info { gap: .42rem; }
  .open-volume .book-detail-info h3 { margin-bottom: .25rem; }
  .open-volume .detail-retailers .shop { padding: .26rem .36rem; }
}

@media (orientation: landscape) and (max-height: 30rem) {
  .volume-editing .dialog-header, .volume-editing .dialog-footer { padding: .3rem .65rem; align-items: center; }
  .open-volume.volume-editing .dialog-header h2 { font-size: 1.15rem; -webkit-line-clamp: 1; }
  .volume-editing .dialog-header button { min-height: 1.8rem; height: 1.8rem; }
  .volume-editing .dialog-scroll { padding: .45rem .65rem; gap: .4rem; }
  .volume-editing .dialog-footer { gap: .2rem; }
  .volume-editing .dialog-footer button, .volume-editor-catalog button { min-height: 1.65rem; padding-block: .12rem; }
  .volume-editor-catalog, .volume-editor-section .spine-field { padding: .35rem; }
  .volume-editor-section .form-grid { row-gap: .25rem; }
  .volume-editor-section .form-grid label, .volume-editor-catalog label { gap: .1rem; font-size: .78rem; }
  .volume-editor-section :is(input,select), .volume-editor-catalog input { padding: .25rem .4rem; }
  .volume-editor-section h3 { margin-bottom: .2rem; font-size: 1rem; }
  .volume-editor-section textarea { height: 3.5rem; }
}
