/* 本棚なう public site. Served from S3 + CloudFront with a content-hashed name. */
@font-face {
  font-family: "Hondanow Sans";
  src: url('/assets/fonts/noto-sans-jp-v1.woff2') format('woff2');
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}
:root {
  --bg: #f7f8f5;
  --panel: #ffffff;
  --ink: #202923;
  --muted: #606b63;
  --line: #dbe1da;
  --accent: #275c4b;
  --accent-ink: #ffffff;
  --shadow: 0 2px 5px rgba(25, 45, 35, .05);
  color-scheme: light;
}
* { box-sizing: border-box; }
:focus-visible { outline: 3px solid #547f69; outline-offset: 4px; }
button, summary { touch-action: manipulation; }
.series-group summary { cursor: pointer; list-style: none; }
.series-group summary::-webkit-details-marker { display: none; }
.series-group summary img { box-shadow: 5px 5px 0 #dbe1da, 9px 9px 0 #e9ede6; width: calc(100% - 9px); }
.series-count { display: inline-block; color: var(--accent); font-size: .8rem; margin-top: .5rem; border-bottom: 1px solid var(--accent); }
.book-list > li:has(details[open]) { grid-column: 1 / -1; }
.book-list details[open] > summary { display: grid; grid-template-columns: 100px 1fr; column-gap: 1.25rem; align-items: start; }
.book-list details[open] > summary > img, .book-list details[open] > summary > .no-cover { grid-row: span 4; }
.book-list details[open] > summary > .series-count { justify-self: start; }
.series-volumes { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 1.5rem; padding: 1.5rem 0 0; list-style: none; }
.series-volumes li { padding: .75rem 0; border-top: 1px solid var(--line); }
.book-list .series-volumes li a { display: block; }
.social-login { margin: 1.5rem 0; }
.social-button { display: block; width: 100%; margin-bottom: .75rem; padding: .8rem; border: 1px solid #bbc4bc; border-radius: 5px; background: white; color: var(--ink); cursor: pointer; font-weight: 600; }
.social-button:hover { background: #edf0e9; }
.auth-divider { text-align: center; color: var(--muted); font-size: .8rem; margin: 1.5rem 0; }
.cover-missing { display: flex !important; align-items: center; justify-content: center; padding: 1rem; border-left: 5px solid #a9bca9; font-size: .8rem; color: var(--muted); line-height: 1.8; }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.8 "Hondanow Sans", "Hiragino Sans", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1 { font-size: clamp(1.65rem, 3vw, 2.25rem); margin: 0 0 .5rem; line-height: 1.5; font-weight: 650; }
h2 { font-size: 1.2rem; margin: 2.5rem 0 1rem; letter-spacing: .025em; font-weight: 600; }
p { margin: .25rem 0; }
.muted { color: var(--muted); font-size: .9rem; }
button { font: inherit; }
input, select { font: inherit; }

.site-header {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .25rem 1rem;
  padding: 1rem max(1.25rem, calc((100vw - 1160px)/2)) 0; border-bottom: 1px solid var(--line); background: var(--panel);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: inline-flex; align-items: center; }
.brand img { height: 38px; width: auto; }
.brand-caption { border-left: 1px solid var(--line); margin-left: 1.25rem; padding-left: 1.25rem; color: var(--muted); font-size: .75rem; }
.site-header > .brand { padding-bottom: .6rem; }
.site-header nav { display: flex; gap: 1rem; font-size: .9rem; color: var(--muted); }
.site-header-top { flex: 1 1 100%; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.account-links { display: flex; align-items: center; gap: .9rem; font-size: .9rem; }
.account-links a:not(.button) { color: var(--muted); }
.button.small { margin-top: 0; padding: .35rem .8rem; font-size: .85rem; }
.site-nav { flex: 1 1 100%; overflow-x: auto; white-space: nowrap; margin-top: .35rem; }
.site-nav a { padding: .35rem 0 .5rem; border-bottom: 2px solid transparent; }
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }
[hidden] { display: none !important; }
.page { max-width: 1200px; margin: 0 auto; padding: 2.25rem 1.25rem 5rem; }
.site-footer { padding: 2rem 1rem; color: var(--muted); font-size: .8rem; text-align: center; border-top: 1px solid var(--line); }

.hero { padding: 2rem 0 3rem; display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 3rem; border-bottom: 1px solid var(--line); }
.hero h1 { font-size: clamp(2rem, 4vw, 3.35rem); line-height: 1.6; letter-spacing: .035em; margin: .6rem 0 1.25rem; font-weight: 600; }
.hero-intro { font-size: .85rem; color: var(--accent); font-weight: 600; }
.hero-description { color: var(--muted); line-height: 2; }
.hero-note { color: var(--muted); font-size: .75rem; margin-top: 1rem; }
.hero-library { background: #e8eee7; padding: 3rem 1.75rem 1.5rem; min-width: 0; }
.hero-book-row { display: flex; align-items: flex-end; gap: 1rem; min-height: 220px; padding: 0 .25rem 1.5rem; border-bottom: 8px solid #bac8bb; }
.hero-book-row a { flex: 1; min-width: 0; }
.hero-book-row img { width: 100%; max-height: 215px; object-fit: contain; object-position: bottom; filter: drop-shadow(4px 6px 3px #243a2620); }
.hero-caption { font-size: .75rem; color: var(--muted); margin-top: 1rem; }
.editorial-cover { display: flex; padding: .75rem; align-items: center; justify-content: center; aspect-ratio: 2/3; background: var(--panel); border-left: 4px solid var(--accent); font-size: .8rem; }
.shelf-word { display: block; font-size: 1.8rem; line-height: 1.9; margin-bottom: 2rem; }
.first-shelf p { color: var(--muted); font-size: .85rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .75rem; }
.hero-actions .button { margin-top: 0; }
.button.secondary { background: var(--panel); color: var(--accent); box-shadow: inset 0 0 0 1px var(--line); }
.button.block { display: block; width: 100%; text-align: center; }

.page-heading { margin: .5rem 0 1.25rem; }
.page-heading h1 { margin-bottom: .35rem; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.section-heading h2 { margin-bottom: .75rem; }
.more-link { color: var(--accent); font-size: .9rem; font-weight: 600; }
.breadcrumb { font-size: .85rem; color: var(--muted); margin-bottom: .5rem; }
.breadcrumb a { color: var(--accent); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Login / sign-up: one narrow column; the code form appears below the first. */
.auth-page { max-width: 460px; margin: 1.5rem auto 0; padding-bottom: 2rem; }
.auth-page h1 { margin-bottom: 1rem; }
.auth-page .form-card { background: var(--panel); padding: 1.25rem; }
.auth-page .form-card h2 { margin: 0 0 .5rem; font-size: 1.05rem; }
.auth-page .form-card p { font-size: .9rem; }
.form-card.is-done { opacity: .6; }
.confirm-card { margin-top: 1rem; border-color: var(--accent); }
.confirm-actions { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: .75rem; }
.field-hint { font-weight: 400; color: var(--muted); font-size: .8rem; }
.legal-note { color: var(--muted); font-size: .8rem !important; margin: .75rem 0; }
.legal-note a { color: var(--accent); text-decoration: underline; }
.auth-switch { margin-top: 1.25rem; text-align: center; font-size: .9rem; }
.auth-switch a, .web-message a { color: var(--accent); text-decoration: underline; }

.steps { list-style: none; counter-reset: step; display: flex; gap: .5rem; padding: 0; margin: 0 0 1rem; font-size: .8rem; color: var(--muted); }
.steps li { counter-increment: step; flex: 1; padding-top: .4rem; border-top: 3px solid var(--line); }
.steps li::before { content: counter(step) ". "; }
.steps li[aria-current] { color: var(--ink); font-weight: 600; border-top-color: var(--accent); }

.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.choice-card { display: grid; gap: .6rem; padding: 1.5rem; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; }
.choice-card:hover { border-color: var(--accent); }
.choice-title { font-weight: 700; font-size: 1.05rem; }
.choice-title::after { content: " →"; color: var(--accent); }

/* マイページ */
.mypage-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.mypage-heading .muted a { color: var(--accent); }
.heading-actions { display: flex; align-items: center; gap: 1rem; }
.heading-actions .button { margin-top: 0; }
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin: 0; }
.stat-tile { border-left: 1px solid var(--line); padding: .8rem 1.5rem; }
.stat-tile dt { color: var(--muted); font-size: .8rem; font-weight: 600; }
.stat-tile dd { margin: .15rem 0 0; font-size: 1.7rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat-tile dd small { font-size: .8rem; font-weight: 600; margin-left: .2rem; color: var(--muted); }
.stat-note { color: var(--muted); font-size: .75rem; margin-top: .2rem; }
.inline-select { display: flex; align-items: center; gap: .5rem; font-size: .85rem; color: var(--muted); }
.inline-select select { padding: .3rem .5rem; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.filter-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.chip { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: .25rem .8rem; font-size: .85rem; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.book-meta { display: block; color: var(--muted); font-size: .72rem; margin-top: .2rem; }

/* みんなの本棚 */
.people-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .75rem; }
.person-card { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; height: 100%; }
/* A little shelf: their newest covers standing on a maple board. */
.person-shelf { display: flex; align-items: flex-end; gap: 4px; height: 92px; padding: 10px 10px 0; overflow: hidden; background: linear-gradient(#f6efe3, #efe4d2); border-bottom: 8px solid #c79a62; box-shadow: inset 0 -1px 0 rgba(0,0,0,.08); }
.person-shelf img { height: 78px; width: auto; max-width: 56px; object-fit: cover; border-radius: 2px; box-shadow: 0 2px 4px rgba(0,0,0,.18); }
.person-body { display: flex; flex-direction: column; padding: .6rem .75rem; min-width: 0; }
.person-bio { color: var(--muted); font-size: .8rem; margin-top: .2rem; }
.shelf-no-image { display: block; background: #efe9df; aspect-ratio: 4 / 3; }
.search-results { max-height: none; margin-top: 1rem; }
.sticky-action { position: sticky; bottom: 1rem; z-index: 2; }
.sticky-action .button { box-shadow: 0 6px 18px rgba(0, 0, 0, .18); }

.form-card { padding: 1.5rem; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.form-card h3 { margin: 0 0 .75rem; font-size: 1rem; }
.form-card label { display: grid; gap: .25rem; margin: .65rem 0; font-size: .85rem; font-weight: 600; }
.form-card input, .form-card select, .form-card textarea { width: 100%; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: var(--ink); }
.form-card .button { border: 0; cursor: pointer; }
.form-card .button:disabled { opacity: .55; cursor: wait; }
#web-progress, #web-review, #web-done { margin-top: 1rem; }
#web-progress h2, #web-review h2, #web-done h2 { margin: 0 0 .75rem; font-size: 1rem; }
#web-progress progress { width: 100%; height: 1rem; }
.web-message { min-height: 1.5rem; margin-top: .75rem; color: var(--accent); font-weight: 600; }
.web-message.error { color: #a52620; }
.spine-review { display: grid; gap: .6rem; max-height: 32rem; overflow: auto; }
.spine-choice { display: grid; grid-template-columns: auto 1fr; gap: .6rem; align-items: start; padding: .65rem; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.spine-choice select { margin-top: .35rem; }
.spine-tier { color: var(--muted); font-size: .75rem; }
.register-options { display: grid; grid-template-columns: 2fr 1fr; gap: 1rem; }
.search-row { display: grid; grid-template-columns: 1fr auto; gap: .75rem; align-items: end; }
.search-row label { margin: 0; }
.book-search-choice { display: grid; grid-template-columns: auto 48px 1fr; gap: .6rem; align-items: center; padding: .55rem; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
.book-search-choice img, .book-search-choice .no-cover { width: 40px; height: 56px; object-fit: contain; }

.profile { display: flex; gap: 1rem; align-items: flex-start; }
.avatar { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; }
.handle { color: var(--muted); }
.stats strong { font-size: 1.2rem; }

.shelf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .75rem; }
.shelf-card { display: block; overflow: hidden; }
.shelf-card img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
.shelf-name { display: block; padding: .5rem .6rem 0; font-weight: 600; font-size: .9rem; }
.shelf-count { display: block; padding: 0 .6rem .5rem; color: var(--muted); font-size: .8rem; }

.book-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 2rem 1.5rem; }
.book-list.ranked { counter-reset: rank; }
.book-list li a { display: block; height: 100%; position: relative; }
.book-list.ranked li a::before { counter-increment: rank; content: counter(rank); position: absolute; top: .35rem; left: .35rem; background: var(--ink); color: #fff; font-size: .7rem; padding: 0 .4rem; border-radius: 4px; }
.book-list img, .no-cover { width: 100%; aspect-ratio: 2 / 3; object-fit: contain; background: #edf0e9; border-radius: 2px; }
.no-cover { display: block; }
.no-cover.large { width: 160px; }
.book-title { display: block; margin-top: .8rem; font-size: .9rem; font-weight: 600; line-height: 1.65; overflow-wrap: anywhere; }
.book-author { display: block; color: var(--muted); font-size: .75rem; margin-top: .15rem; }

.tags { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.tag { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: .2rem .7rem; font-size: .85rem; }
.tag span { color: var(--muted); margin-left: .3rem; }
.tag-series::before { content: "📚 "; }

.user-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.user-list li a { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: .6rem .8rem; }
.user-name { font-weight: 600; }
.user-handle, .user-score { color: var(--muted); font-size: .8rem; }

.book { display: flex; gap: 1.25rem; align-items: flex-start; }
.book-cover img { width: 160px; border-radius: 6px; box-shadow: var(--shadow); }
.subtitle { color: var(--muted); }
.authors { margin-top: .5rem; }
.button { display: inline-block; padding: .75rem 1.4rem; border-radius: 5px; background: var(--accent); color: var(--accent-ink); font-weight: 600; margin-top: .75rem; min-height: 44px; }
.button.amazon::after { content: " ↗"; }
.edition-list { list-style: none; padding: 0; margin: 0; }
.edition-list li { display: flex; justify-content: space-between; gap: 1rem; padding: .4rem 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.edition-list a { color: var(--accent); }

.link-button { background: none; border: none; color: var(--accent); cursor: pointer; padding: 0; font-weight: 600; }
.common { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; margin-top: 1.5rem; }
.common h2 { margin-top: 0; }
.common input { font: inherit; padding: .35rem .5rem; border: 1px solid var(--line); border-radius: 6px; }

.shelf-viewer { width: min(96vw, 1100px); max-height: 92vh; border: none; border-radius: 12px; padding: 1rem; box-shadow: var(--shadow); }
.shelf-viewer::backdrop { background: rgba(35, 32, 28, .55); }
.shelf-viewer .close { float: right; border: none; background: none; font-size: 1.4rem; cursor: pointer; }
.shelf-stage { position: relative; }
.shelf-stage img { width: 100%; border-radius: 8px; }
.shelf-stage svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.shelf-stage polygon { fill: rgba(181, 80, 46, .12); stroke: rgba(181, 80, 46, .8); stroke-width: 2; cursor: pointer; transition: fill .15s; }
.shelf-stage polygon:hover, .shelf-stage polygon.active { fill: rgba(181, 80, 46, .4); }
.shelf-stage polygon.unknown { fill: rgba(120, 120, 120, .05); stroke: rgba(120, 120, 120, .4); cursor: default; }
.shelf-stage img { display: block; }
.shelf-stage .registration-map polygon.registered { fill: rgba(34, 160, 90, .22); stroke: #177342; }
.shelf-stage .registration-map polygon.unregistered { fill: rgba(220, 65, 65, .22); stroke: #b83232; }
.shelf-stage .registration-map polygon.active, .shelf-stage .registration-map polygon:focus { stroke: #164fba; stroke-width: 5; outline: none; }
.registration-legend { display: flex; flex-wrap: wrap; gap: 1.2rem; font-size: .9rem; }
.spine-editor { width: min(94vw, 720px); max-height: 92dvh; padding: 1.25rem; border: 1px solid var(--line); border-radius: 12px; }
.spine-editor::backdrop { background: rgba(20, 30, 25, .65); }
.spine-editor-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.spine-editor-heading h2 { font-size: 1.1rem; }
.spine-context { display: flex; gap: 1rem; background: #eef1ee; padding: .6rem; margin: .75rem 0; height: 160px; }
.spine-context .spine-location { flex: 1; min-width: 0; }
.spine-context .spine-crop { width: 80px; flex: none; }
.spine-editor .search-row label { flex: 1; min-width: 0; }
.spine-editor label { display: flex; flex-direction: column; gap: .4rem; }
.spine-editor input { width: 100%; }
.spine-editor .spine-pick { display: flex; flex-direction: column; align-items: flex-start; width: 100%; }
.manual-record { display: block; }

@media (max-width: 600px) {
  .book { flex-direction: column; }
  .book-cover img { width: 120px; }
  .site-header nav { gap: .6rem; }
  .register-options { grid-template-columns: 1fr; }
  .search-row { grid-template-columns: 1fr; }
  .account-links { gap: .6rem; }
}

/* マイページ配下（設定・本・本棚写真） */
.choice-grid.compact { margin: 1.25rem 0 .5rem; }
.choice-grid.compact .choice-card { padding: .9rem 1rem; }
.text-filter { width: 100%; max-width: 360px; padding: .5rem .7rem; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); margin-bottom: .6rem; font: inherit; }
.settings-card { background: var(--panel); margin-top: 1rem; max-width: 640px; }
.settings-card h2 { margin: .25rem 0 .5rem; font-size: 1rem; }
.form-card textarea { font: inherit; resize: vertical; }
.prefixed { display: flex; align-items: center; gap: .3rem; }
.prefixed > span { color: var(--muted); font-weight: 600; }
.form-card label.switch-row { display: flex; gap: .75rem; align-items: flex-start; font-weight: 400; }
.form-card label.switch-row input { width: 1.2rem; height: 1.2rem; margin-top: .15rem; flex: none; accent-color: var(--accent); }
.form-card progress { width: 100%; height: .8rem; accent-color: var(--accent); }
.danger-card { border-color: #e7c7c2; }
.button.danger { background: #a52620; }
.button.danger:disabled { opacity: .45; cursor: not-allowed; }
.segmented { display: flex; flex-wrap: wrap; gap: 0; margin: .25rem 0 1rem; }
.segmented label { margin: 0 !important; display: block !important; }
.segmented input { position: absolute; opacity: 0; width: 1px !important; }
.segmented span { display: block; padding: .4rem .9rem; border: 1px solid var(--line); margin-left: -1px; background: var(--panel); cursor: pointer; font-weight: 600; }
.segmented label:first-child span { border-radius: 8px 0 0 8px; margin-left: 0; }
.segmented label:last-child span { border-radius: 0 8px 8px 0; }
.segmented input:checked + span { background: var(--ink); color: #fff; border-color: var(--ink); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.stars { display: flex; gap: .15rem; margin-bottom: .5rem; }
.star { border: 0; background: none; font-size: 1.6rem; line-height: 1; cursor: pointer; color: #c9a227; padding: .1rem; }
.spine-list { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .5rem; }
.spine-list a, .spine-pick { display: grid; grid-template-columns: 40px 1fr; gap: .75rem; align-items: center; width: 100%; text-align: left; padding: .5rem .6rem; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font: inherit; color: inherit; }
.spine-list img, .spine-list .no-cover { width: 40px; height: 56px; object-fit: contain; }
.spine-list strong, .spine-list .muted { display: block; }
.spine-pick:hover, .spine-list a:hover { border-color: var(--accent); }
.shelf-stage polygon.selectable { cursor: pointer; }
.shelf-stage polygon.unknown.selectable:hover { fill: rgba(120, 120, 120, .25); }

/* タイトルで追加: シリーズ（単行本）の枠 */
.series-results { margin: 1.25rem 0 1.5rem; }
.series-results h2 { margin-top: 0; }
.series-card { display: grid; grid-template-columns: 88px 1fr; gap: 1rem; padding: 1rem; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; margin-bottom: .75rem; }
.series-card img, .series-card .no-cover { width: 88px; aspect-ratio: 2 / 3; object-fit: contain; border-radius: 4px; }
.series-card h3 { margin: 0 0 .2rem; font-size: 1.05rem; }
.series-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.series-actions .button { margin-top: 0; border: 0; cursor: pointer; }
.series-actions .button.secondary { border: 0; }
.series-actions .button:disabled { opacity: .55; cursor: default; }
.series-volume-picker { list-style: none; padding: 0; margin: .75rem 0 .5rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: .35rem; max-height: 22rem; overflow: auto; }
.series-volume-picker label { display: flex; align-items: center; gap: .35rem; padding: .3rem .45rem; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); font-size: .85rem; cursor: pointer; }
.series-volume-picker .muted { display: none; }
.volume-no { font-weight: 700; font-variant-numeric: tabular-nums; }
.is-owned { opacity: .55; }
.series-volume-picker li.is-owned .volume-no::after, .book-search-choice.is-owned strong::after { content: " 登録済み"; font-size: .7rem; font-weight: 600; color: var(--muted); }
@media (max-width: 600px) { .series-card { grid-template-columns: 64px 1fr; } .series-card img, .series-card .no-cover { width: 64px; } }

/* 本のページ: 書誌とリンク */
.book-facts { display: grid; grid-template-columns: auto 1fr; gap: .25rem 1rem; margin: .75rem 0; font-size: .92rem; }
.book-facts div { display: contents; }
.book-facts dt { color: var(--muted); }
.book-facts dd { margin: 0; }
.book-facts a, .about-links a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.link-group h2 { font-size: .9rem; margin: 1.1rem 0 .4rem; color: var(--muted); }
.shop-links { display: flex; flex-wrap: wrap; gap: .5rem; }
.shop-links .button { margin-top: 0; }
.about-links { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; font-size: .9rem; }

/* ログイン・新規登録: 本の壁の上に浮かぶカード（Pixiv 風） */
.auth-body .page { max-width: none; padding: 0; }
.auth-body .site-footer { position: relative; z-index: 1; background: var(--bg); }
.auth-scene { position: relative; min-height: calc(100vh - 110px); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2.5rem 1rem 3rem; overflow: hidden; isolation: isolate; }
.auth-backdrop { position: absolute; inset: -10% -5%; z-index: -1; display: flex; gap: 14px; transform: rotate(-8deg) scale(1.15);
  background: repeating-linear-gradient(90deg, #6b4f3f 0 18px, #b96a55 18px 30px, #e6d5b8 30px 44px, #4d3c35 44px 60px, #8a9a7b 60px 72px); }
.auth-backdrop.has-images { background: #2b2420; }
.auth-backdrop::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(30, 24, 20, .55), rgba(30, 24, 20, .72)); }
.auth-column { flex: 1; display: flex; flex-direction: column; gap: 14px; animation: auth-drift 60s linear infinite; }
.auth-column.reverse { animation-direction: reverse; animation-duration: 75s; }
.auth-column img { width: 100%; border-radius: 10px; object-fit: cover; aspect-ratio: 3 / 4; background: #3a302a; }
@keyframes auth-drift { from { transform: translateY(0); } to { transform: translateY(-50%); } }
@media (prefers-reduced-motion: reduce) { .auth-column { animation: none; } }
@media (max-width: 700px) { .auth-backdrop { inset: -25% -60%; transform: rotate(-8deg) scale(1.2); } }
.auth-scene .auth-page { position: relative; width: 100%; max-width: 420px; margin: 0; padding: 1.75rem 1.5rem 1.25rem; background: var(--panel); border-radius: 16px; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.auth-scene .auth-page .form-card { border: 0; padding: 0; background: transparent; box-shadow: none; }
.auth-brand { text-align: center; margin-bottom: 1rem; }
.auth-brand img { height: 44px; width: auto; margin: 0 auto .4rem; }
.auth-brand p { color: var(--muted); font-size: .85rem; margin: 0; }
.auth-scene .auth-page h1 { font-size: 1.2rem; text-align: center; }
.auth-backdrop-credit { position: relative; margin-top: 1rem; color: rgba(255, 255, 255, .8); font-size: .75rem; }

/* トップ: 未ログインは登録ランディング、ログイン後はフィード */
.hero-photo { border-radius: 18px; overflow: hidden; min-height: 240px; background: #efe9df; }
.hero-photo img { width: 100%; height: 100%; object-fit: cover; display: block; aspect-ratio: 4 / 3; }
html.authed .home-landing, html:not(.authed) .home-feed { display: none; }
.home-landing .auth-scene { width: 100vw; margin-left: calc(50% - 50vw); margin-top: -2.25rem; }
.landing { position: relative; width: 100%; max-width: 1080px; display: grid; grid-template-columns: 1fr 420px; gap: 3rem; align-items: center; }
.landing-copy { color: #fff; text-shadow: 0 2px 12px rgba(0, 0, 0, .45); }
.landing-copy .hero-intro { color: #f3c9b8; }
.landing-title { font-size: clamp(2rem, 4.5vw, 3.4rem); line-height: 1.25; margin: .4rem 0 1rem; color: #fff; }
.landing-copy .hero-description, .landing-copy .hero-note { color: rgba(255, 255, 255, .88); }
.landing-links { display: flex; gap: 1.25rem; margin-top: 1.25rem; font-weight: 700; }
.landing-links a { color: #fff; text-decoration: underline; text-underline-offset: 4px; }
.landing .auth-page { max-width: none; }
.auth-title { text-align: center; font-size: 1.2rem; margin: 0 0 .75rem; }
@media (max-width: 900px) {
  .landing { grid-template-columns: 1fr; gap: 1.5rem; }
  .landing-copy { text-align: center; }
  .landing-links { justify-content: center; }
}

/* 新着の本棚: Pinterest 風の石組み */
.masonry { column-width: 230px; column-gap: 14px; }
.pin { display: inline-block; width: 100%; margin: 0 0 14px; break-inside: avoid; border-radius: 16px; background: var(--panel); overflow: hidden; box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease; }
.pin:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(35, 32, 28, .16); }
.pin-media { position: relative; display: block; }
.pin-media img { width: 100%; height: auto; display: block; }
.pin-media .shelf-no-image { aspect-ratio: 4 / 3; }
.pin-overlay { position: absolute; inset: 0; display: flex; align-items: flex-start; justify-content: flex-end; padding: .6rem; background: linear-gradient(180deg, rgba(0, 0, 0, .35), transparent 45%); opacity: 0; transition: opacity .15s ease; }
.pin:hover .pin-overlay, .pin:focus-visible .pin-overlay { opacity: 1; }
.pin-cta { background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: .8rem; padding: .4rem .8rem; border-radius: 999px; }
.pin-caption { display: block; padding: .55rem .7rem .7rem; }
.pin-caption .shelf-name { padding: 0; }
.pin-owner { display: flex; align-items: center; gap: .4rem; color: var(--muted); font-size: .8rem; margin-top: .25rem; }
.pin-avatar { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--line); color: var(--ink); font-size: .7rem; font-weight: 700; }

/* おすすめ */
.recommend-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.recommend-card { display: grid; grid-template-columns: 72px 1fr; gap: .8rem; padding: .8rem; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.recommend-cover img, .recommend-cover .no-cover { width: 72px; aspect-ratio: 2 / 3; object-fit: contain; border-radius: 4px; }
.recommend-body .book-title { margin-top: 0; }
.recommend-rating { display: block; color: #c9a227; font-size: .85rem; letter-spacing: .05em; }
.recommend-text { font-size: .88rem; margin: .35rem 0; white-space: pre-line; }
.recommend-shops { display: flex; gap: .8rem; font-size: .82rem; }
.recommend-shops a { color: var(--accent); text-decoration: underline; }
.affiliate-note { font-size: .75rem; margin-top: .5rem; }
.recommender-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.recommender-list li { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: .7rem .9rem; }
.recommender-list a { display: flex; gap: .5rem; align-items: baseline; }

/* 近くの図書館 */
.privacy-note { background: var(--panel); border: 1px dashed var(--line); border-radius: 10px; padding: .7rem .9rem; font-size: .88rem; max-width: 640px; }
.library-saved, .library-found, .library-results { list-style: none; padding: 0; margin: .5rem 0; display: grid; gap: .45rem; }
.library-saved li, .library-found li, .library-results li { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .5rem .7rem; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; flex-wrap: wrap; }
.library-found li > span { display: grid; }
.library-found .button { margin-top: 0; border: 0; cursor: pointer; }
.library-found .button:disabled { opacity: .5; cursor: default; }
.library-results .library-name { flex: 1; font-weight: 600; }
.library-results a { color: var(--accent); font-size: .85rem; }
.availability { font-size: .8rem; font-weight: 700; padding: .15rem .55rem; border-radius: 999px; background: var(--line); }
.availability.ok { background: #dcefdc; color: #1f5f2c; }
.availability.busy { background: #fbe6c8; color: #7a4a06; }
.availability.none { background: #eee; color: #666; }
.library-check { margin-top: 1.5rem; }
.calil-credit { font-size: .75rem; color: var(--muted); }
.calil-credit a { text-decoration: underline; }

/* 本多なつき: 案内の吹き出し */
.natsuki-says { display: flex; align-items: flex-end; gap: .75rem; margin: 1rem 0 1.25rem; max-width: 720px; }
.natsuki-figure { width: 104px; height: auto; flex: none; filter: drop-shadow(0 4px 8px rgba(35, 32, 28, .12)); }
.natsuki-bubble { position: relative; flex: 1; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: .75rem 1rem; box-shadow: var(--shadow); }
.natsuki-bubble::before { content: ""; position: absolute; left: -8px; bottom: 22px; width: 14px; height: 14px; background: var(--panel); border-left: 1px solid var(--line); border-bottom: 1px solid var(--line); transform: rotate(45deg); }
.natsuki-bubble p { margin: .15rem 0; font-size: .92rem; }
.natsuki-name { display: block; font-size: .72rem; font-weight: 700; color: var(--accent); letter-spacing: .05em; }
@media (max-width: 600px) { .natsuki-figure { width: 76px; } }

/* 本多なつき: PS ゲーム風ローディング（歩行 16 コマ、173x184 のスプライト） */
.natsuki-loader { --frame-w: 122px; --frame-h: 130px; margin: 1rem 0; padding: .75rem 1rem 1rem; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.natsuki-track { position: relative; height: calc(var(--frame-h) + 6px); overflow: hidden; border-bottom: 2px dashed var(--line); }
.natsuki-walker {
  position: absolute; bottom: 2px; left: 0; width: var(--frame-w); height: var(--frame-h);
  background-repeat: no-repeat; background-size: calc(var(--frame-w) * 16) var(--frame-h);
  animation: natsuki-steps 1.1s steps(16) infinite, natsuki-across 9s linear infinite;
  animation-delay: 0s, -3s;  /* already on stage when the loader appears */
}
@keyframes natsuki-steps { from { background-position: 0 0; } to { background-position: calc(var(--frame-w) * -16) 0; } }
@keyframes natsuki-across { from { transform: translateX(calc(-1 * var(--frame-w))); } to { transform: translateX(min(100vw, 960px)); } }
.natsuki-label { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin: .6rem 0 .2rem; font-weight: 700; }
.natsuki-dots { font-family: ui-monospace, Menlo, monospace; font-size: .78rem; letter-spacing: .12em; color: var(--muted); }
.natsuki-dots::after { content: ""; animation: natsuki-dots 1.4s steps(4) infinite; }
@keyframes natsuki-dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
.natsuki-tip-wrap { display: flex; gap: .5rem; align-items: baseline; margin: 0; font-size: .88rem; color: var(--ink); }
.natsuki-tip-wrap .natsuki-name { display: inline; flex: none; }
@media (prefers-reduced-motion: reduce) {
  .natsuki-walker { left: calc(50% - var(--frame-w) / 2); animation: natsuki-steps 2.2s steps(16) infinite; }
  .natsuki-dots::after { animation: none; content: "..."; }
}

/* 解析中・確認待ち */
.background-note { font-size: .85rem; color: var(--muted); margin: 0 0 .5rem; }
.background-note a { color: var(--accent); text-decoration: underline; }
.job-list { list-style: none; padding: 0; margin: .5rem 0 0; display: grid; gap: .45rem; }
.job-list a { display: grid; grid-template-columns: auto 1fr auto; gap: .75rem; align-items: center; padding: .55rem .75rem; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
.job-list a:hover { border-color: var(--accent); }
.job-state { font-size: .78rem; font-weight: 700; padding: .12rem .55rem; border-radius: 999px; background: var(--line); }
.job-completed { background: #dcefdc; color: #1f5f2c; }
.job-failed { background: #f6d9d6; color: #8a2a22; }

/* Legal pages (/terms, /privacy). */
.legal { max-width: 720px; }
.legal p, .legal li { margin: .5rem 0; }
.legal ol, .legal ul { padding-left: 1.4rem; }
.legal-table { width: 100%; border-collapse: collapse; font-size: .9rem; margin: .5rem 0; }
.legal-table th, .legal-table td { border: 1px solid var(--line); padding: .45rem .55rem; text-align: left; vertical-align: top; }
.legal-table th { background: var(--panel); font-weight: 600; }

@media (max-width: 700px) {
  .hero { grid-template-columns: 1fr; gap: 1.5rem; padding-top: .5rem; }
  .hero h1 { font-size: 2.4rem; }
  .hero-library { padding: 1.5rem 1.25rem 1rem; }
  .hero-book-row { min-height: 150px; max-width: 420px; margin: auto; }
  .hero-book-row img { max-height: 180px; }
  .brand-caption { display: none; }
  .desktop-break { display: none; }
  .page { padding-top: 1.5rem; }
  .book-list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem .85rem; }
  .book-title { font-size: .8rem; }
  .stat-tile { padding: .5rem .85rem; }
  .series-volumes { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .85rem; }
}
@media (max-width: 380px) {
  .book-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .account-links { gap: .6rem; }
}

/* The library: quiet reading surfaces, generous cover art, clear actions. */
.skip-link { position: fixed; top: -80px; left: 16px; z-index: 100; padding: 12px 20px; background: var(--ink); color: white; }
.skip-link:focus { top: 12px; }
.page-heading { padding-bottom: 1.5rem; margin-bottom: 1.5rem; border-bottom: 1px solid var(--line); }
.page-heading h1 { font-weight: 750; letter-spacing: -.025em; }
.page-heading .muted, .page-lead { max-width: 48rem; line-height: 1.9; }
.greeting { font-size: .85rem; color: var(--accent); margin-bottom: .5rem; }
.mypage-heading { align-items: center; }
.library-overview { background: #eaf0e9; padding: 1.5rem .5rem; border-radius: 16px; margin-bottom: 2rem; }
.library-overview .stat-tile:first-child { border-left: 0; }
.stat-tile dd { font-size: 2.15rem; letter-spacing: -.035em; }
.library-collection { margin-top: 2.5rem; padding-top: .5rem; }
.library-collection .section-heading { align-items: center; flex-wrap: wrap; gap: 1rem; }
.book-list { gap: 2.5rem 1.75rem; }
.book-list img, .book-list .no-cover { padding: 16px; border-radius: 12px; background: #edf0e9; }
.book-list a, .series-group summary { border-radius: 12px; transition: color .18s; }
.book-list a:hover .book-title, .series-group summary:hover .book-title { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }
.book-title { font-size: .95rem; font-weight: 650; }
.book-author { font-size: .8rem; }
.shelf-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); gap: 1.75rem; }
.shelf-card { background: var(--panel); border-radius: 16px; border: 1px solid var(--line); transition: border-color .18s; }
.shelf-card:hover { border-color: var(--accent); }
.shelf-name { padding: 1rem 1.25rem .25rem; font-size: 1rem; }
.shelf-count { padding: 0 1.25rem 1.25rem; }
.shelf-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.button { border-radius: 10px; min-height: 44px; display: inline-flex; justify-content: center; align-items: center; gap: .5rem; }
.choice-card { border-radius: 14px; padding: 1.5rem; transition: border-color .18s, background .18s; }
.choice-card:hover { background: #f0f4ed; }
.choice-grid.compact { gap: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.choice-grid.compact .choice-card { background: none; border: 0; border-radius: 0; }
.registration-choices { margin-top: 2rem; grid-template-columns: 1.35fr 1fr; }
.registration-choices .choice-card { overflow: hidden; align-content: start; }
.photo-choice img { width: calc(100% + 3rem); max-width: none; height: 220px; object-fit: cover; margin: -1.5rem -1.5rem 1rem; }
.search-choice-mark { display: grid; place-items: center; width: 80px; height: 104px; color: #fff; background: #426653; border-left: 7px solid #254f3d; border-radius: 3px 8px 8px 3px; font-size: 2rem; margin: 1rem 0 2rem; }
.recognition-activity { display: block; padding: .85rem max(1.25rem, calc((100vw - 1160px)/2)); background: #e0ecdf; color: #244f3c; font-size: .9rem; border-bottom: 1px solid #bfd1bd; }
.recognition-activity:hover { text-decoration: underline; text-underline-offset: 4px; }
.upload-workspace { display: grid; grid-template-columns: 1.25fr 1fr; max-width: none; gap: 2.5rem; padding: 2rem; border-radius: 18px; margin-top: 1.5rem; }
.photo-picker { min-width: 0; padding: 1.5rem; border: 1px dashed #90a991; border-radius: 12px; background: #f2f5ef; }
.photo-picker > label { font-size: 1.15rem; font-weight: 700; }
.photo-picker input { width: 100%; max-width: 100%; padding: 1rem 0; border: 0; background: none; }
.photo-picker input::file-selector-button { font: inherit; padding: .65rem 1rem; margin-right: .75rem; border: 1px solid var(--line); border-radius: 8px; background: white; cursor: pointer; }
#upload-preview { width: 100%; max-height: 340px; object-fit: contain; border-radius: 8px; margin-top: .75rem; }
#upload-file-detail { overflow-wrap: anywhere; }
.photo-guidance h2 { margin-top: 0; }
.photo-guidance ul { padding-left: 1.2rem; line-height: 2; margin: 1.5rem 0; }
.photo-guidance .button { width: 100%; margin: 1.5rem 0 .75rem; }
#web-progress, #web-done { max-width: 760px; margin: 2rem auto; padding: 2rem; border-radius: 18px; }
#web-progress progress { width: 100%; height: 12px; accent-color: var(--accent); }
#web-progress h2, #web-done h2 { margin-top: 0; }
.steps { margin: 2rem 0 1rem; gap: 1rem; }
.steps li { padding-top: .8rem; font-size: .9rem; }
.job-list a { background: white; padding: 1rem; border-radius: 10px; }
.form-card { border-radius: 14px; }
.user-list { gap: 1rem; }
.user-list li a { padding: 1.25rem; border-radius: 12px; }
@media (max-width: 640px) {
  .page { padding: 1.5rem 1rem 4rem; }
  .library-overview { padding: 1rem 0; }
  .stat-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem 0; }
  .stat-tile { padding: .5rem 1rem; }
  .stat-tile:nth-child(odd) { border-left: 0; }
  .book-list { gap: 1.75rem 1rem; }
  .book-list img, .book-list .no-cover { padding: 12px; }
  .registration-choices, .upload-workspace { grid-template-columns: 1fr; }
  .upload-workspace { padding: 1rem; gap: 1.5rem; }
  .job-list a { grid-template-columns: auto 1fr; }
  .job-list a > .muted { grid-column: 2; }
  .site-nav { scrollbar-width: none; }
  .photo-choice img { height: 180px; }
}
@media (prefers-reduced-motion: reduce) {
  .choice-card, .shelf-card, .book-list a { transition: none; }
}

/* タイトルで追加: one block per queued title */
.paste-titles textarea { width: 100%; box-sizing: border-box; margin: .5rem 0; font: inherit; }
.query-block { margin: 1rem 0; padding: .75rem 1rem; border: 1px solid var(--line, #e6e0d6); border-radius: 12px; background: var(--card, #fff); }
.query-head { display: flex; align-items: center; gap: .75rem; }
.query-head h2 { flex: 1; margin: 0; font-size: 1.05rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.query-state { font-size: .85rem; color: var(--muted, #7a736a); }
.query-searching::before { content: ""; display: inline-block; width: .8em; height: .8em; margin-right: .35em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: query-spin .8s linear infinite; vertical-align: -.1em; }
.query-failed { color: #b3261e; }
.button.small { padding: .25rem .6rem; font-size: .8rem; }
@keyframes query-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .query-searching::before { animation: none; } }
.search-field { display: flex; gap: 1rem; margin: 0 0 .5rem; }
.search-field label { display: inline-flex; align-items: center; gap: .3rem; }

/* ---------------------------------------------------------- バーチャル本棚 */
.virtual-shelf-styles { display: flex; gap: .5rem; margin: 0 0 .75rem; }
.virtual-shelf-styles button { border: 1px solid var(--line, #e6e0d6); background: var(--card, #fff); border-radius: 999px; padding: .3rem .9rem; font: inherit; cursor: pointer; }
.virtual-shelf-styles button[aria-selected="true"] { background: #275c4b; border-color: #275c4b; color: #fff; }
.virtual-shelf { border-radius: 12px; padding: 16px 16px 0; overflow: hidden; }
.virtual-shelf a { text-decoration: none; }

/* 背表紙: spines standing on wooden boards (rows of 210px: 198 space + 12 board). */
.virtual-shelf[data-style="spines"] {
  display: flex; flex-wrap: wrap; align-items: flex-end; align-content: flex-start; gap: 0 2px;
  background: repeating-linear-gradient(to bottom, #3b2a20 0 198px, #7a5536 198px 210px), #3b2a20;
  padding-bottom: 0;
}
.virtual-shelf[data-style="spines"]::after { content: ""; flex: 1 0 100%; height: 0; }
.vs-spine {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  margin-bottom: 12px; margin-top: calc(198px - var(--h, 0px)); box-sizing: border-box; padding: 10px 2px 8px;
  border-radius: 3px 3px 1px 1px; color: #fff; box-shadow: inset -3px 0 0 rgba(0,0,0,.18), inset 2px 0 0 rgba(255,255,255,.12);
  transition: transform .15s ease;
}
.vs-spine:hover, .vs-spine:focus-visible { transform: translateY(-8px); }
.vs-spine-title { writing-mode: vertical-rl; font-size: 12px; line-height: 1.1; max-height: 78%; overflow: hidden; letter-spacing: .05em; font-weight: 600; }
.vs-spine-no { font-size: 11px; font-weight: 700; opacity: .9; }

/* 喫茶店: covers faced out on narrow wall ledges. */
.virtual-shelf[data-style="cafe"] {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 0 18px;
  background: repeating-linear-gradient(to bottom, #efe6d6 0 188px, #8a6446 188px 196px, #d9ccb6 196px 204px), #efe6d6;
  padding: 16px 20px 0; grid-auto-rows: 204px;
}
.vs-face { display: flex; align-items: flex-end; justify-content: center; padding-bottom: 16px; }
.vs-face img, .vs-face .vs-plain-cover { width: 96px; height: 140px; object-fit: cover; border-radius: 2px; transform: rotate(var(--tilt, 0deg));
  box-shadow: 0 6px 10px rgba(60,40,20,.28); transition: transform .15s ease; }
.vs-face:hover img, .vs-face:hover .vs-plain-cover { transform: rotate(0deg) scale(1.05); }
.vs-plain-cover { display: flex; flex-direction: column; justify-content: space-between; box-sizing: border-box; padding: 10px 8px; color: #fff; }
.vs-plain-title { font-size: 12px; font-weight: 700; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; }
.vs-plain-author { font-size: 10px; opacity: .85; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* 平積み: stacks of books lying on a bookshop table. */
.virtual-shelf[data-style="stack"] {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 24px 20px; padding: 24px 20px;
  background: linear-gradient(#caa57a, #b88f62);
}
.vs-stack { display: flex; flex-direction: column-reverse; align-items: center; width: 180px; }
.vs-flat { display: block; box-sizing: border-box; height: 26px; margin-top: -1px; padding: 0 10px; border-radius: 2px; color: #fff;
  font-size: 12px; line-height: 26px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transform: translateX(var(--shift, 0));
  box-shadow: 0 2px 0 rgba(0,0,0,.2); }
.vs-flat:hover { filter: brightness(1.15); }

@media (prefers-reduced-motion: reduce) {
  .vs-spine, .vs-face img, .vs-face .vs-plain-cover { transition: none; }
}

/* ---------------------------------------------------- 18歳以上向け */
.age-gate { max-width: 560px; margin: 2rem auto; text-align: center; }
.age-gate-actions { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; }

/* 予測 (title completion) under the search field */
#web-book-search { position: relative; }
.suggest-list { position: absolute; left: 1rem; right: 1rem; z-index: 20; margin: -.25rem 0 0; padding: .25rem 0; list-style: none;
  background: var(--card, #fff); border: 1px solid var(--line, #e6e0d6); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.suggest-list li { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem .9rem; cursor: pointer; }
.suggest-list li:hover { background: #f1efe9; }
.badge { display: inline-block; margin-right: .4rem; padding: 0 .45rem; border-radius: 999px; background: #e7efe9; color: #275c4b; font-size: .72rem; font-weight: 700; }
.manual-book form { display: grid; gap: .6rem; margin-top: .75rem; }
.feed-footer { text-align: center; padding: 2rem 1rem 3rem; min-height: 130px; color: var(--muted); }
.feed-footer .button { margin-top: 1rem; }
/* Appending rows to columns must not animate the entire existing feed. */
.masonry[data-layout="grid"] { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); grid-auto-rows: 8px; gap: 12px; }
.masonry[data-layout="grid"] .pin { align-self: start; margin: 0; min-width: 0; }
@media (max-width: 520px) { .masonry[data-layout="grid"] { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .masonry { column-width: auto; column-count: 2; column-gap: 12px; } }

/* Shop offers (title, price, date) and banner slots */
.shop-offers { display: grid; gap: .6rem; margin: .75rem 0; }
.shop-offer { display: flex; gap: .75rem; align-items: center; padding: .6rem; border: 1px solid #95a5a6; border-radius: .75rem; background: #fff; color: inherit; text-decoration: none; }
.shop-offer img { width: 72px; height: auto; flex: none; }
.shop-offer-body { display: grid; gap: .15rem; font-size: .85rem; }
.shop-offer-title { font-weight: 600; }
.shop-offer-cta { justify-self: start; margin-top: .25rem; padding: .15rem .8rem; border-radius: 999px; background: #bf0000; color: #fff; font-size: .8rem; }
.shop-amazon .shop-offer-cta { background: #232f3e; }
.ad-slot { position: relative; margin: 1.5rem auto; text-align: center; }
.ad-label { display: block; font-size: .7rem; color: var(--muted, #7a736a); margin-bottom: .2rem; }
.ad-slot img { max-width: 100%; height: auto; }
.ad-square { display: none; }
@media (max-width: 520px) {
  .ad-wide { display: none; }
  .ad-square { display: inline-block; }
}
.ad-only { display: inline-block !important; }

/* ------------------------------------------------ user header (/@handle) */
.user-header { margin-bottom: 1.25rem; }
.user-header-main { display: flex; flex-wrap: wrap; gap: 1rem 1.25rem; align-items: center; }
.user-header .avatar { width: 84px; height: 84px; }
.avatar-blank { display: inline-flex; align-items: center; justify-content: center; background: #e7ddcb; color: #6b5134; font-size: 2rem; font-weight: 700; }
.user-header-info { flex: 1 1 260px; min-width: 0; }
.user-header-info h1 { margin: 0; }
.user-header-info .handle { margin: .1rem 0 0; color: var(--muted); }
.user-header-info .bio { margin: .4rem 0 0; }
.user-activity { display: flex; gap: 1.5rem; list-style: none; margin: 0; padding: 0; }
.user-activity li { display: flex; flex-direction: column; }
.user-activity .label { font-size: .75rem; color: var(--muted); }
.user-tabs { display: flex; gap: .25rem; margin-top: 1rem; border-bottom: 1px solid var(--line); }
.user-tabs a { padding: .55rem 1.1rem; color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -1px; font-weight: 600; }
.user-tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

/* ------------------------------------------- 本棚モード (covers on boards) */
.bookshelf-bar { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; margin-bottom: .5rem; }
.bookshelf-bar .filter-chips, .bookshelf-bar .text-filter { margin-bottom: 0; }
.bookshelf-bar .text-filter { flex: 1 1 180px; }
.bookshelf-modes { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.bookshelf-modes button { border: 0; background: var(--panel); padding: .4rem .9rem; font: inherit; cursor: pointer; }
.bookshelf-modes button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.bookshelf-count { margin: 0 0 .5rem; font-size: .85rem; }
.shelf-wrapper { --row: 176px; --board: 18px; border-radius: 6px; overflow: hidden; box-shadow: 0 6px 18px rgba(60, 35, 10, .18); }
.shelf-area {
  border: solid #a8723f; border-width: 14px 14px 0;
  /* Back panel: maple with a faint vertical grain. */
  background:
    repeating-linear-gradient(90deg, rgba(120, 70, 20, .05) 0 2px, transparent 2px 9px, rgba(120, 70, 20, .03) 9px 10px, transparent 10px 23px),
    linear-gradient(#e2bf8c, #d9b27b);
}
.shelf-inner {
  list-style: none; margin: 0; padding: 0 14px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); column-gap: 16px;
  grid-auto-rows: var(--row);
  /* One board under every row: top face, then the front edge with a shadow. */
  background: repeating-linear-gradient(to bottom,
    transparent 0 calc(var(--row) - var(--board)),
    rgba(60, 30, 5, .28) calc(var(--row) - var(--board)) calc(var(--row) - var(--board) + 3px),
    #c48c55 calc(var(--row) - var(--board) + 3px) calc(var(--row) - var(--board) + 7px),
    #a8723f calc(var(--row) - var(--board) + 7px) var(--row));
}
.shelf-item { align-self: end; margin-bottom: var(--board); min-width: 0; }
.shelf-item a { position: relative; display: flex; align-items: flex-end; justify-content: center; height: 140px; text-decoration: none; color: inherit; }
.shelf-item img { display: block; max-width: 100%; max-height: 140px; width: auto; height: auto; border-radius: 1px 3px 3px 1px;
  box-shadow: 1px 0 0 rgba(255, 255, 255, .25) inset, 3px 3px 5px rgba(40, 20, 0, .4); transition: transform .15s ease; }
.shelf-item a:hover img, .shelf-item a:focus-visible img, .shelf-item a:hover .shelf-noimage { transform: translateY(-4px); }
.shelf-noimage { display: flex; align-items: center; justify-content: center; width: 92px; max-width: 100%; height: 132px; padding: .5rem;
  background: #f4efe4; border: 1px solid #d6c8ae; border-radius: 1px 3px 3px 1px; box-shadow: 3px 3px 5px rgba(40, 20, 0, .35);
  font-size: .72rem; line-height: 1.45; color: #4a3b29; text-align: center; overflow: hidden; transition: transform .15s ease; }
.shelf-noimage span { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.shelf-item-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.item-secret-badge { position: absolute; left: 50%; bottom: 4px; transform: translateX(-50%); background: rgba(32, 41, 35, .82); color: #fff; font-size: .65rem; padding: .05rem .4rem; border-radius: 3px; }
.shelf-footer { height: 26px; background: linear-gradient(#b07a46, #85582f); border-top: 2px solid #cf9a62; }
@media (max-width: 600px) {
  .shelf-wrapper { --row: 150px; --board: 14px; }
  .shelf-area { border-width: 10px 10px 0; }
  .shelf-inner { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); column-gap: 10px; padding: 0 8px; }
  .shelf-item a { height: 118px; }
  .shelf-item img { max-height: 118px; }
  .shelf-noimage { height: 110px; font-size: .65rem; }
}
@media (prefers-reduced-motion: reduce) { .shelf-item img, .shelf-noimage { transition: none; } }

/* リスト: the same items as rows. */
.shelf-wrapper[data-mode="list"] { box-shadow: none; border: 1px solid var(--line); border-radius: 10px; }
.shelf-wrapper[data-mode="list"] .shelf-area { border: 0; background: var(--panel); }
.shelf-wrapper[data-mode="list"] .shelf-inner { display: block; background: none; padding: 0; }
.shelf-wrapper[data-mode="list"] .shelf-item { margin: 0; border-top: 1px solid var(--line); }
.shelf-wrapper[data-mode="list"] .shelf-item:first-child { border-top: 0; }
.shelf-wrapper[data-mode="list"] .shelf-item a { height: auto; justify-content: flex-start; align-items: center; gap: .9rem; padding: .6rem .9rem; }
.shelf-wrapper[data-mode="list"] .shelf-item img, .shelf-wrapper[data-mode="list"] .shelf-noimage { width: 44px; max-height: 64px; height: auto; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.shelf-wrapper[data-mode="list"] .shelf-noimage { height: 62px; font-size: 0; padding: 0; }
.shelf-wrapper[data-mode="list"] .shelf-item-title { position: static; width: auto; height: auto; clip: auto; white-space: normal; }
.shelf-wrapper[data-mode="list"] .item-secret-badge { position: static; transform: none; margin-left: auto; }
.shelf-wrapper[data-mode="list"] .shelf-footer { display: none; }

/* The card a cover opens. */
.book-card-dialog { border: 0; border-radius: 12px; padding: 1.25rem; width: min(560px, calc(100vw - 32px)); box-shadow: 0 20px 50px rgba(0, 0, 0, .3); }
.book-card-dialog::backdrop { background: rgba(20, 25, 22, .45); }
.book-card-dialog .close { float: right; border: 0; background: none; font-size: 1.5rem; cursor: pointer; line-height: 1; }
.book-card { display: flex; gap: 1.1rem; align-items: flex-start; }
.book-card-cover { flex: 0 0 110px; }
.book-card-cover img { width: 110px; height: auto; box-shadow: 2px 3px 8px rgba(0, 0, 0, .3); border-radius: 2px; }
.book-card-cover .shelf-noimage { width: 110px; height: 156px; }
.book-card-info { flex: 1; min-width: 0; }
.book-card-info h2 { margin: 0 0 .5rem; font-size: 1.1rem; line-height: 1.45; }
.book-card-info ul { list-style: none; margin: 0 0 .9rem; padding: 0; display: grid; gap: .2rem; font-size: .9rem; }
.book-card-actions { margin: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
@media (max-width: 480px) { .book-card { flex-direction: column; align-items: center; text-align: center; } .book-card-actions { justify-content: center; } }

/* ------------------------------------------- search result card (登録) */
.search-results { display: grid; gap: .6rem; }
.book-search-choice.search-card { display: grid; grid-template-columns: auto 80px minmax(0, 1fr) auto; gap: .9rem; align-items: start; padding: .9rem; }
.search-card-pick { padding-top: .2rem; }
.search-card-image img { width: 80px; height: auto; max-height: 120px; object-fit: contain; box-shadow: 1px 2px 5px rgba(0, 0, 0, .2); border-radius: 2px; }
.search-card-image .shelf-noimage { width: 80px; height: 112px; font-size: .65rem; box-shadow: 1px 2px 5px rgba(0, 0, 0, .15); }
.search-card-title { margin: .1rem 0 .35rem; font-size: 1rem; line-height: 1.45; }
.search-card-owners { margin: 0 0 .3rem; font-size: .8rem; color: var(--muted); }
.search-card-owners .num { font-weight: 700; color: var(--ink); margin-right: .1rem; }
.search-card-meta { margin: 0; display: flex; flex-wrap: wrap; gap: .15rem .9rem; font-size: .82rem; color: var(--muted); }
.search-card-actions { display: flex; flex-direction: column; align-items: stretch; gap: .45rem; min-width: 150px; position: relative; }
.add-item-btn { border: 0; border-radius: 6px; background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 700; padding: .55rem .9rem; cursor: pointer; }
.add-item-btn:disabled { background: #e3ebe5; color: var(--accent); cursor: default; }
.search-card.is-owned .add-item-btn::before { content: "✓ "; }
.add-item-menu { display: grid; gap: .3rem; padding: .5rem; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); box-shadow: var(--shadow); }
.add-item-menu select { font: inherit; padding: .3rem; border: 1px solid var(--line); border-radius: 5px; }
.add-status { border: 1px solid var(--line); background: var(--bg); border-radius: 5px; padding: .4rem .6rem; font: inherit; font-size: .85rem; cursor: pointer; text-align: left; }
.add-status:hover, .add-status:focus-visible { border-color: var(--accent); }
.store-button { display: block; text-align: center; border: 1px solid #d5a24a; background: #fff7e6; color: #6b4a10; border-radius: 6px; padding: .45rem .9rem; font-size: .85rem; font-weight: 600; text-decoration: none; }
.search-card.is-owned strong::after { content: none; }
@media (max-width: 640px) {
  .book-search-choice.search-card { grid-template-columns: auto 64px minmax(0, 1fr); }
  .search-card-image img, .search-card-image .shelf-noimage { width: 64px; }
  .search-card-actions { grid-column: 2 / -1; min-width: 0; flex-direction: row; flex-wrap: wrap; }
  .search-card-actions .add-item-btn, .search-card-actions .store-button { flex: 1 1 140px; }
  .add-item-menu { flex: 1 1 100%; }
}

/* 新着の蔵書: one card per book someone added. */
.book-feed { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 18px 14px; }
.feed-book { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.feed-cover img, .feed-cover .no-cover { width: 100%; aspect-ratio: 2 / 3; object-fit: contain; background: #edf0e9; border-radius: 3px; box-shadow: 0 2px 6px rgba(35, 32, 28, .14); }
.feed-cover .no-cover { display: grid; place-items: center; padding: .5rem; font-size: .8rem; text-align: center; color: var(--muted); }
.feed-book .book-title { font-weight: 600; font-size: .9rem; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.feed-book .book-author { color: var(--muted); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-owner { display: flex; align-items: center; gap: .35rem; font-size: .78rem; color: var(--muted); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 600px) { .book-feed { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 10px; } }
