/* ぶらり書店 ― 棚の前をぶらぶら歩く本屋。詳細は DESIGN.md */

:root {
  --night: #140e0a;        /* 店内の闇 */
  --wood-deep: #22170f;    /* 棚の奥 */
  --wood: #4a3222;         /* 棚板 */
  --wood-edge: #6e4c33;    /* 棚板の木口 */
  --lamp: #f1e4c6;         /* 電球色の文字 */
  --lamp-dim: #a8977a;
  --lamp-faint: #5c4d3c;
  --shu: #c4532f;          /* 朱。カゴにだけ使う */
  --shu-press: #a8432a;
  --paper: #ede3cc;        /* 手に取った本を照らす紙の色 */
  --ink: #2a221b;
  --ink-dim: #6b5d4c;
  --line-dark: #2c2017;    /* 暗い所の区切り線 */
  --paper-line: #d3c6a8;   /* 紙の上の区切り線 */
  --paper-edge: #c9bb9c;   /* 紙の上の枠 */
  --paper-under: #b5a684;  /* 紙の上の下線 */
  --paper-deep: #d6cab0;   /* 表紙が届く前の面 */
  --on-shu: #fff6ea;       /* 朱の上の字 */
  --table: #3a2a1d;        /* 見取り図の台 */
  --table-lit: #5a4330;

  --mincho: "Shippori Mincho", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --gothic: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic", sans-serif;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --bar-h: 52px;
  --bay-w: min(88vw, 400px);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--night);
  color: var(--lamp);
  font-family: var(--gothic);
  font-size: 15px;
  line-height: 1.7;
  letter-spacing: .03em;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--lamp); outline-offset: 2px; }
/* 紙の上では電球色の枠が見えないので、墨の色で */
.sheet :focus-visible { outline-color: var(--ink); }
.book-title:focus { outline: none; }
/* スクロールバーも店の色に(Windows の白いバーが暗い店内で浮かないように) */
.view-map { scrollbar-color: var(--lamp-faint) transparent; scrollbar-width: thin; }
.sheet, .vols-list { scrollbar-color: var(--paper-edge) transparent; scrollbar-width: thin; }

/* ---- 上の帯 ---- */
.bar {
  position: fixed; inset: 0 0 auto 0; height: var(--bar-h); z-index: 10;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 0 var(--s4);
  background: var(--night);
  border-bottom: 1px solid var(--line-dark);
}
.shopname {
  grid-column: 2; margin: 0;
  font-family: var(--mincho); font-weight: 600; font-size: 17px; letter-spacing: .24em;
}
/* 店名を押すと、どこからでも見取り図(入口)へ戻る */
.shopname a { color: inherit; text-decoration: none; padding: var(--s2) 0; }
.shopname a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .4em; }
.bar-left, .basket-btn, .find-btn {
  background: none; border: 0; padding: var(--s2) 0; font-size: 13px; letter-spacing: .08em; color: var(--lamp-dim);
}
.bar-left { justify-self: start; }
.bar-left::before { content: "← "; }
.bar-left:hover, .basket-btn:hover, .find-btn:hover, .find-btn[aria-pressed="true"] { color: var(--lamp); }
.bar-right { grid-column: 3; justify-self: end; display: flex; align-items: center; gap: var(--s4); }
.basket-btn { display: inline-flex; align-items: center; gap: var(--s2); }
@media (max-width: 420px) {
  .bar { grid-template-columns: auto 1fr auto; gap: var(--s3); padding: 0 var(--s3); }
  .shopname { font-size: 15px; letter-spacing: .14em; text-align: center; }
  .bar-right { gap: var(--s3); }
}
.basket-count {
  min-width: 22px; height: 22px; padding: 0 6px; display: inline-grid; place-items: center;
  border: 1px solid var(--lamp-faint); border-radius: 2px; font-size: 12px; color: var(--lamp-dim);
  font-variant-numeric: tabular-nums;
}
.basket-count.has { background: var(--shu); border-color: var(--shu); color: var(--on-shu); }
.basket-count.bump { animation: bump .32s var(--ease); }
@keyframes bump { 40% { transform: scale(1.25); } }

.view { position: fixed; inset: var(--bar-h) 0 0 0; }

/* ---- 見取り図 ---- */
.view-map {
  overflow-y: auto;
  padding: var(--s5) var(--s4) var(--s7);
  background: radial-gradient(ellipse 70% 45% at 50% 0%, #2e2116 0%, var(--night) 70%);
}
.map-head { max-width: 560px; margin: 0 auto var(--s5); text-align: center; }
.map-date { margin: 0; font-size: 12px; color: var(--lamp-dim); letter-spacing: .12em; }
.map-lead { margin: var(--s1) 0 0; font-family: var(--mincho); font-size: 18px; line-height: 1.6; }
.map-how { margin: var(--s2) 0 0; font-size: 12px; line-height: 1.8; color: var(--lamp-dim); word-break: auto-phrase; }

/* 店内案内図(SVG)。棚の長さは冊数に比例 */
.map-body { max-width: 560px; margin: 0 auto; display: grid; gap: var(--s6); }
/* PCでも図がひと目で収まるよう、高さは画面に合わせる */
/* 上の帯と見出し(3行)の分を引く。PC(1366×800)でも図の下まで1画面に */
.plan { display: block; width: 100%; height: auto; max-height: max(360px, calc(100dvh - 244px)); overflow: visible; }
.plan-wall { fill: none; stroke: var(--lamp-faint); stroke-width: 2; }
.plan-aisle { fill: none; stroke: var(--lamp-faint); stroke-width: 1; stroke-dasharray: 2 5; }
.plan-door { font-family: var(--gothic); font-size: 10px; fill: var(--lamp-dim); letter-spacing: .3em; }
.plan-gondola { fill: var(--wood-deep); stroke: var(--table); stroke-width: 1; }
.plan-shelf { stroke: var(--wood-edge); stroke-width: 6; stroke-linecap: butt; transition: stroke .15s; }
.plan-sec { cursor: pointer; outline: none; }
.plan-hit { fill: transparent; stroke: transparent; stroke-width: 34; stroke-linecap: square; pointer-events: all; }
rect.plan-hit { stroke: none !important; stroke-width: 0; pointer-events: fill; }
.plan-sec:hover .plan-hit, .plan-sec:focus-visible .plan-hit { fill: rgba(241, 228, 198, .04); stroke: rgba(241, 228, 198, .04); }
.plan-name { font-family: var(--mincho); font-weight: 600; font-size: 12px; letter-spacing: .14em; fill: var(--lamp); pointer-events: none; }
.plan-sec:hover .plan-shelf, .plan-sec:focus-visible .plan-shelf, .plan-shelf.hl, [data-label].hl .plan-shelf { stroke: var(--lamp); }
.plan-sec:focus-visible .plan-name { text-decoration: underline; }
/* 平台(新刊・売れ筋): 棚ではなく台なので、面で描く */
.plan-table { fill: var(--table); stroke: var(--wood-edge); stroke-width: 1; transition: fill .15s, stroke .15s; }
.plan-tables:hover .plan-table, .plan-tables:focus-visible .plan-table, .plan-tables.hl .plan-table { fill: var(--table-lit); stroke: var(--lamp); }
.plan-register { cursor: pointer; outline: none; }
/* レジはカゴの場所なので、カゴと同じ朱で縁取る(朱はカゴにだけ使う約束の内) */
.plan-register rect { fill: rgba(196, 83, 47, .12); stroke: var(--shu); stroke-width: 1.5; transition: fill .15s; }
.plan-register text { font-family: var(--mincho); font-weight: 600; font-size: 11px; fill: var(--lamp); letter-spacing: .2em; }
.plan-register:hover rect, .plan-register:focus-visible rect { fill: var(--shu); }
.plan-register:hover text, .plan-register:focus-visible text { fill: var(--on-shu); }

/* 入口の案内板: 売り場 → レーベル */
.board { border-top: 1px solid var(--lamp-faint); padding-top: var(--s4); }
.board-title { margin: 0 0 var(--s4); font-family: var(--gothic); font-weight: 500; font-size: 11px; letter-spacing: .3em; color: var(--lamp-dim); }
.board-sec { display: grid; grid-template-columns: 9em minmax(0, 1fr); gap: var(--s2) var(--s4); padding: var(--s3) 0; border-bottom: 1px solid var(--line-dark); }
.board-sec h3 { margin: 0; }
.board-sec h3 button {
  background: none; border: 0; padding: 0; text-align: left; display: grid; gap: 2px;
}
.board-sec .bn { font-family: var(--mincho); font-weight: 600; font-size: 16px; letter-spacing: .12em; line-height: 1.4; border-bottom: 1px solid transparent; justify-self: start; }
.board-sec .bc { font-size: 11px; color: var(--lamp-dim); font-variant-numeric: tabular-nums; }
.board-sec h3 button:hover .bn, .board-sec h3 button:focus-visible .bn { border-bottom-color: var(--lamp-dim); }
.board-sec ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(10em, 1fr)); gap: 0 var(--s4); }
.board-sec a {
  display: flex; align-items: baseline; gap: var(--s2); padding: var(--s1) 0;
  color: var(--lamp); text-decoration: none; font-family: var(--mincho); font-size: 14px; line-height: 1.5;
}
.board-sec a .ln { flex: none; }
.board-sec a .lc { flex: 1; text-align: right; font-family: var(--gothic); font-size: 11px; color: var(--lamp-dim); font-variant-numeric: tabular-nums; border-bottom: 1px dotted var(--lamp-faint); }
.board-sec a:hover .ln, .board-sec a:focus-visible .ln { text-decoration: underline; text-underline-offset: 3px; }
.board-sec a:hover .lc { color: var(--lamp); }
.board-tables h3 { display: grid; gap: 2px; align-content: start; }
.board-tables h3 .bn { border: 0; }
.board-tables a .lc { font-size: 11px; letter-spacing: .04em; }
.map-note { max-width: 560px; margin: var(--s5) auto 0; font-size: 12px; color: var(--lamp-dim); line-height: 1.9; }
.map-note a { color: var(--lamp-dim); text-underline-offset: 3px; }
.map-note a:hover { color: var(--lamp); }

@media (max-width: 420px) {
  .board-sec { grid-template-columns: minmax(0, 1fr); gap: var(--s1); }
  .board-sec h3 button, .board-tables h3 { display: flex; align-items: baseline; gap: var(--s3); }
  .board-tables ul { grid-template-columns: minmax(0, 1fr); }
  .board-sec ul { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--s3); }
  .board-sec a { font-size: 13px; }
  .board-sec a .ln { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* ---- 棚の前 ---- */
.view-shelf { background: var(--night); display: flex; flex-direction: column; }
.view-shelf[hidden], .find-bar[hidden] { display: none; }
.aisle {
  flex: 1; min-height: 0; display: flex; overflow-x: auto; overflow-y: hidden;
  padding: var(--s3) 0 calc(68px + env(safe-area-inset-bottom)); gap: 0;
  scrollbar-width: none; overscroll-behavior-x: contain;
  user-select: none; -webkit-user-select: none;
}
.aisle::-webkit-scrollbar { display: none; }
.aisle-msg { margin: auto; padding: 0 var(--s5); max-width: 100%; text-align: center; font-family: var(--mincho); font-size: 14px; line-height: 1.9; color: var(--lamp-dim); overflow-wrap: anywhere; word-break: auto-phrase; }
.aisle-msg p { margin: 0; }
/* 探して見つからないときの行き先 */
.aisle-msg .aisle-away { margin-top: var(--s4); display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s2) var(--s4); font-family: var(--gothic); font-size: 13px; }
.aisle-away a { color: var(--lamp); text-underline-offset: 4px; text-decoration-color: var(--lamp-faint); }
.aisle-away a:hover { text-decoration-color: var(--lamp); }
.aisle-msg .aisle-ad { margin-top: var(--s2); font-family: var(--gothic); font-size: 11px; color: var(--lamp-dim); }
/* 初めて棚の前に来たときの一言 */
.walk-hint {
  position: absolute; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 2;
  margin: 0; padding: var(--s2) var(--s4); max-width: calc(100% - 32px); width: max-content;
  background: var(--paper); color: var(--ink); font-size: 12px; letter-spacing: .06em; line-height: 1.6; text-align: center;
  animation: hint-in .3s var(--ease);
}
.walk-hint[hidden] { display: none; }
@keyframes hint-in { from { opacity: 0; transform: translate(-50%, 8px); } }
.aisle:focus-visible { outline: none; }
/* PCではマウスで棚をつかんで歩ける */
@media (pointer: fine) {
  .aisle { cursor: grab; }
  .aisle.dragging, .aisle.dragging * { cursor: grabbing; }
}

/* 探す: 棚の上に細い帯 */
.find-bar {
  flex: none; display: flex; align-items: baseline; gap: var(--s3);
  padding: var(--s3) var(--s4) var(--s2); border-bottom: 1px solid var(--line-dark);
}
.find-label { flex: none; font-size: 11px; letter-spacing: .3em; color: var(--lamp-dim); }
.find-input {
  flex: 1; min-width: 0; padding: var(--s1) 0; border: 0; border-bottom: 1px solid var(--lamp-faint); border-radius: 0;
  background: none; color: var(--lamp); font-family: var(--mincho); font-size: 16px; letter-spacing: .06em;
  -webkit-appearance: none; appearance: none;
}
.find-input::placeholder { color: var(--lamp-faint); }
.find-input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.find-input:focus { outline: none; border-bottom-color: var(--lamp-dim); }

.bay {
  flex: none; width: var(--bay-w); height: 100%;
  display: grid; grid-template-rows: auto repeat(var(--tiers, 4), 1fr);
  background: linear-gradient(180deg, #2a1d13 0%, var(--wood-deep) 55%, #170f0a 100%);
  border-left: 9px solid var(--wood); border-right: 9px solid var(--wood);
  box-shadow: inset 10px 0 14px -10px #000, inset -10px 0 14px -10px #000; /* 棚の奥行き */
}
.bay + .bay { border-left-width: 0; }
.bay-plate {
  margin: 0 var(--s3) var(--s2); padding: 3px var(--s2) 2px;
  justify-self: start; max-width: calc(100% - 24px);
  background: var(--paper); color: var(--ink);
  font-family: var(--mincho); font-size: 12px; font-weight: 600; letter-spacing: .1em; line-height: 1.5;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bay-plate small { font-weight: 400; color: var(--ink-dim); margin-left: var(--s2); font-size: 11px; }
.tier {
  position: relative; min-height: 0;
  display: flex; align-items: flex-end; gap: 0;
  padding: 0 4px;
  border-bottom: 8px solid var(--wood);
}
/* 棚板の木口の細い線(影ではなく線で) */
.tier::after { content: ""; position: absolute; left: 0; right: 0; bottom: -9px; height: 1px; background: var(--wood-edge); pointer-events: none; }
/* 読み込むあいだの空の棚 */
.bay.ghost { opacity: .45; }
.aisle-msg.aisle-wait { position: absolute; left: 0; right: 0; top: 40%; margin: 0; pointer-events: none; }

/* 背表紙 */
.spine {
  --c: #777; --fg: #f4ecd8; --band: var(--c);
  position: relative; flex: none; border: 0; padding: 0; margin: 0;
  height: var(--h, 86%); width: var(--w, 26px);
  background: var(--c); color: var(--fg);
  display: flex; flex-direction: column; align-items: center; overflow: hidden;
  box-shadow: inset 1px 0 0 rgba(255,255,255,.08), inset -1px 0 0 rgba(0,0,0,.35);
  transition: transform .18s var(--ease), filter .18s;
  -webkit-tap-highlight-color: transparent;
}
.spine.pulled { transform: translateY(-14%); filter: brightness(1.15); }
.spine-title {
  writing-mode: vertical-rl; text-orientation: mixed;
  font-family: var(--mincho); font-weight: 600; font-size: var(--fs, 12px); line-height: 1.2; letter-spacing: .06em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1 1 auto; min-height: 0; padding-top: var(--top, 18px);
}
/* 著者名は背の下 3 割を必ず確保する */
.spine-author {
  writing-mode: vertical-rl; font-size: var(--fsa, 10px); line-height: 1; letter-spacing: .04em;
  white-space: nowrap; overflow: hidden; height: var(--ah, 30%); padding: 4px 0 0; flex: none;
  margin-top: auto; /* 書名が短いときも著者名は背の下にそろえる */
}
.spine-foot { flex: none; width: 100%; height: 5px; background: rgba(0,0,0,.22); }

/* 型: 生成り地に色帯 */
.spine.t-band { background: #e9dfc6; color: var(--ink); }
.spine.t-band::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 11%; background: var(--c); }
.spine.t-band .spine-foot { background: var(--c); height: 6px; }
/* 型: 古紙地に細い色線 */
.spine.t-paper { background: #d9cba7; color: #3b2f22; }
.spine.t-paper::before, .spine.t-paper::after { content: ""; position: absolute; left: 0; right: 0; height: 2px; background: var(--c); }
.spine.t-paper::before { top: 7%; }
.spine.t-paper::after { bottom: calc(var(--ah, 30%) + 6px); }
.spine.t-paper .spine-foot { background: var(--c); height: 3px; }
/* 型: 白地に色文字 */
.spine.t-white { background: #efeae0; color: var(--cd, var(--c)); }
.spine.t-white .spine-author { color: #4a4036; }
.spine.t-white .spine-foot { background: var(--c); height: 4px; }

/* 仕切り板(五十音の行・作家名)。本より少し背が高い */
.divider {
  flex: none; align-self: flex-end; height: 96%; width: 18px; margin: 0 2px;
  background: var(--paper); color: var(--ink);
  border-top: 3px solid #cbbd9d;
  display: flex; justify-content: center; padding-top: 6px; overflow: hidden;
}
.divider span { writing-mode: vertical-rl; font-family: var(--mincho); font-weight: 700; line-height: 1; white-space: nowrap; }
.divider.d-row span { font-size: 14px; }
.divider.d-author { width: 20px; background: #dccfb2; }
.divider.d-author span { font-size: 11px; letter-spacing: .12em; font-weight: 600; }
.divider.d-label { width: 26px; height: 100%; background: var(--ink); color: var(--paper); border-top-color: var(--wood-edge); padding-top: 10px; }
.divider.d-label span { font-size: 13px; letter-spacing: .16em; }
.divider.lit { animation: lit 2.4s var(--ease); }
@keyframes lit { 0%, 55% { background: var(--lamp); color: var(--ink); outline: 2px solid var(--lamp); } }
/* カゴから「この本の棚へ」来たとき、その本を灯す */
.spine.lit, .faceout.lit { animation: litbook 2.4s var(--ease); }
@keyframes litbook { 0%, 55% { outline: 2px solid var(--lamp); outline-offset: 2px; transform: translateY(-6%); } }
/* 型: 単行本 */
.spine.t-cloth .spine-title { font-size: var(--fs, 14px); }
/* 書名を2行に組む太い本 */
.spine.two .spine-title {
  white-space: pre; line-height: 1.2; text-overflow: clip; /* 改行の位置は app.js の splitTitle が決める */
  max-width: calc(var(--fs) * 2.5); align-self: center;
}

/* 面陳 */
.faceout {
  position: relative; flex: none; border: 0; padding: 0; margin: 0 6px;
  height: var(--h, 86%); aspect-ratio: 105 / 148; background: #2a2018;
  transition: transform .18s var(--ease);
}
.faceout img { width: 100%; height: 100%; object-fit: contain; object-position: center bottom; display: block; }
.faceout.pulled { transform: translateY(-8%); }
.faceout .pop {
  position: absolute; left: -4px; bottom: 6%; padding: 2px var(--s1);
  background: var(--paper); color: var(--ink); font-size: 11px; letter-spacing: .06em; line-height: 1.4;
  font-family: var(--mincho); font-weight: 600;
}

/* 通路の端 */
.bay-end {
  flex: none; width: var(--bay-w); height: 100%;
  display: flex; flex-direction: column; justify-content: center; gap: var(--s4);
  padding: 0 var(--s6);
  border-left: 9px solid var(--wood);
}
.bay-end p { margin: 0; color: var(--lamp-dim); font-size: 12px; letter-spacing: .12em; }
.bay-end .next {
  align-self: flex-start; background: none; border: 0; border-bottom: 1px solid var(--lamp-dim); padding: var(--s1) 0;
  font-family: var(--mincho); font-size: 22px; font-weight: 600; letter-spacing: .14em; text-align: left;
}
.bay-end .next:hover { border-color: var(--lamp); }
.bay-end .back { align-self: flex-start; background: none; border: 0; padding: 0; color: var(--lamp-dim); font-size: 13px; }
.bay-end .back:hover { color: var(--lamp); }

/* 下の帯: 上に棚全体の目盛り(押す・つかんで動かすと歩ける)、下にいまいる所と「案内」 */
.whereabouts {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: 32px 36px; column-gap: var(--s3);
  padding: 0 var(--s4) env(safe-area-inset-bottom);
  font-size: 12px; color: var(--lamp-dim); letter-spacing: .1em;
  background: var(--night); border-top: 1px solid var(--line-dark);
}
.track { grid-column: 1 / -1; position: relative; cursor: pointer; touch-action: none; outline: none; }
.track::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--lamp-faint); }
/* 指で押しやすいよう、押せる範囲は目盛りの上下にも広げる */
.track::after { content: ""; position: absolute; left: 0; right: 0; top: calc(-1 * var(--s2)); bottom: 0; }
.track .ticks b { position: absolute; top: calc(50% - 6px); width: 1px; height: 12px; background: var(--lamp-faint); }
.track i { position: absolute; top: calc(50% - 6px); height: 12px; min-width: 16px; background: var(--lamp-dim); transition: background .15s; }
.track.active i, .track:focus-visible i { background: var(--lamp); }
.track:focus-visible::before { background: var(--lamp-dim); }
.where-line { margin: 0; align-self: center; display: flex; gap: var(--s3); min-width: 0; white-space: nowrap; overflow: hidden; }
.where-line span:last-child { overflow: hidden; text-overflow: ellipsis; }
.whereabouts .here { flex: none; color: var(--lamp); font-family: var(--mincho); font-weight: 600; }
.guide-btn {
  align-self: center; min-height: 28px; padding: 0 var(--s3);
  background: none; border: 1px solid var(--lamp-faint); border-radius: 2px; color: var(--lamp-dim); font-size: 12px; letter-spacing: .1em;
}
.guide-btn[hidden] { display: none; }

/* 棚の案内: 上にレーベルの見出し、下に選んだレーベルの行と作家 */
.sheet-head:has(.guide-tabs) { flex-wrap: wrap; }
.guide-tabs { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 0 var(--s4); margin-top: var(--s1); }
.guide-tabs[hidden] { display: none; }
.guide-tabs button {
  background: none; border: 0; border-bottom: 2px solid transparent; padding: var(--s1) 0;
  font-family: var(--mincho); font-size: 14px; font-weight: 600; letter-spacing: .06em; color: var(--ink-dim);
}
.guide-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.guide-label { padding: var(--s2) 0 var(--s3); }
.guide-start {
  display: block; margin: 0 0 var(--s3); background: none; border: 0; padding: 0;
  font-family: var(--mincho); font-size: 15px; font-weight: 700; letter-spacing: .1em;
  border-bottom: 1px solid var(--paper-under);
}
.guide-start::after { content: "　→"; font-weight: 400; }
.guide-start:hover { border-bottom-color: var(--ink); }
.guide-sub { margin: var(--s4) 0 var(--s1); font-size: 11px; letter-spacing: .3em; color: var(--ink-dim); }
.guide-rows { display: flex; flex-wrap: wrap; gap: var(--s1); }
.guide-rows button {
  min-width: 40px; height: 40px; padding: 0 var(--s1); border: 1px solid var(--paper-edge); border-radius: 2px; background: none;
  font-family: var(--mincho); font-size: 14px; font-weight: 600;
}
.guide-authors { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s3); margin-top: var(--s2); }
.guide-authors button { background: none; border: 0; padding: 2px 0; font-size: 13px; color: var(--ink-dim); border-bottom: 1px solid transparent; }

/* ---- 手に取った本・カゴ ---- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(8,5,3,.55); }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21;
  max-width: 560px; margin: 0 auto; max-height: 86vh; overflow-y: auto;
  background: var(--paper); color: var(--ink);
  padding: var(--s3) var(--s5) calc(var(--s5) + env(safe-area-inset-bottom));
  animation: rise .26s var(--ease);
}
@keyframes rise { from { transform: translateY(100%); } }
.sheet-grip { width: 36px; height: 3px; background: var(--paper-edge); margin: 0 auto var(--s4); }
.sheet-title { font-family: var(--mincho); font-size: 18px; letter-spacing: .14em; margin: 0 0 var(--s4); }
/* 長いシートの見出し。「閉じる」をいつも上に見せておく */
.sheet-head {
  position: sticky; top: calc(-1 * var(--s3)); z-index: 1;
  display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
  margin: calc(-1 * var(--s3)) calc(-1 * var(--s5)) var(--s3); padding: var(--s3) var(--s5) var(--s2);
  background: var(--paper); border-bottom: 1px solid var(--paper-line);
}
.sheet-head .sheet-title { margin: 0; }

.book-detail { display: grid; grid-template-columns: 112px 1fr; gap: var(--s4); align-items: start; }
.book-cover { width: 112px; aspect-ratio: 105 / 148; object-fit: contain; object-position: center top; background: var(--paper-deep); display: block; }
/* 表紙のない本の仮の表紙: 背の色の面に、書名を明朝の縦書きで、下に著者。字の色は app.js が背の明るさで決める */
.book-blank[hidden], .book-cover[hidden] { display: none; }
.book-cover.blank {
  display: flex; flex-direction: column; align-items: center; gap: var(--s2);
  padding: var(--s3) var(--s2) var(--s2); overflow: hidden;
}
.blank-title {
  writing-mode: vertical-rl; flex: 1 1 auto; min-height: 0; overflow: hidden;
  font-family: var(--mincho); font-weight: 700; font-size: 14px; line-height: 1.3; letter-spacing: .08em;
}
.blank-author { writing-mode: vertical-rl; flex: none; max-height: 45%; overflow: hidden; text-overflow: ellipsis; font-size: 11px; letter-spacing: .06em; white-space: nowrap; }
.blank-note { margin: var(--s1) 0 0; font-size: 11px; color: var(--ink-dim); line-height: 1.5; text-align: center; word-break: auto-phrase; }
.book-meta { min-width: 0; }
.book-label { margin: 0 0 var(--s1); font-size: 11px; letter-spacing: .14em; color: var(--ink-dim); }
.book-title { margin: 0; font-family: var(--mincho); font-weight: 700; font-size: 20px; line-height: 1.45; letter-spacing: .04em; font-feature-settings: "palt"; word-break: auto-phrase; }
.book-sub { margin: var(--s1) 0 0; font-family: var(--mincho); font-size: 13px; line-height: 1.6; color: var(--ink-dim); }
.book-sub:empty { display: none; }
.book-author { margin: var(--s3) 0 0; font-size: 14px; }
.book-pub { margin: var(--s1) 0 0; font-size: 12px; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
/* 続きものの巻 */
.book-vols { margin-top: var(--s4); padding-top: var(--s3); border-top: 1px solid var(--paper-line); }
.book-vols[hidden] { display: none; }
.vols-note { margin: 0 0 var(--s2); font-size: 12px; color: var(--ink-dim); }
.vols-list { display: flex; flex-wrap: wrap; gap: var(--s1); max-height: 152px; overflow-y: auto; }
.vols-list button {
  min-width: 36px; height: 36px; padding: 0 var(--s2); border: 1px solid var(--paper-edge); border-radius: 2px; background: none;
  font-family: var(--mincho); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.vols-list button[aria-current] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.book-desc { margin: var(--s4) 0 0; font-size: 14px; line-height: 1.9; max-width: 40em; }
.book-desc:empty { display: none; }
.book-reviews { margin-top: var(--s4); padding-top: var(--s3); border-top: 1px solid var(--paper-line); font-size: 12px; color: var(--ink-dim); line-height: 1.8; }
.book-reviews b { font-weight: 500; color: var(--ink); }
/* 新聞名 | 日付と評者。折り返すときは評者の前で */
.rv-line { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0 var(--s3); }
.rv-who { display: inline-block; }

.sheet-actions { display: flex; gap: var(--s3); margin-top: var(--s5); }
/* 手に取った本の下の帯。内容紹介が長くても、カゴ・楽天・棚に戻すはいつも見えている */
#bookSheet { padding-bottom: 0; }
.sheet-foot {
  position: sticky; bottom: 0; z-index: 1;
  margin: var(--s4) calc(-1 * var(--s5)) 0; padding: var(--s3) var(--s5) calc(var(--s2) + env(safe-area-inset-bottom));
  background: var(--paper); border-top: 1px solid var(--paper-line);
}
.sheet-foot .sheet-actions { margin-top: 0; }
.sheet-foot-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-top: var(--s1); }
.sheet-foot-row .sheet-close { margin: 0; padding: var(--s2) 0 var(--s2) var(--s4); }
.ad-note { font-size: 11px; color: var(--ink-dim); letter-spacing: .04em; }
/* 3つのボタンは文字の長さに合わせて幅を分ける。スマホでも1行に収める */
.sheet-foot .btn-primary, .sheet-foot .btn-secondary { flex: 1 1 auto; white-space: nowrap; }
@media (max-width: 560px) {
  .sheet-foot { margin-left: calc(-1 * var(--s5)); margin-right: calc(-1 * var(--s5)); padding-left: var(--s4); padding-right: var(--s4); }
  .sheet-foot .sheet-actions { gap: var(--s2); }
  .sheet-foot .btn-primary, .sheet-foot .btn-secondary { padding: 0 var(--s2); font-size: 13px; letter-spacing: .02em; }
}
@media (max-width: 380px) {
  .sheet-foot .btn-primary, .sheet-foot .btn-secondary { font-size: 12px; letter-spacing: 0; }
}
/* とても狭いスマホ(320px)でも、3つのボタンを1行に */
@media (max-width: 340px) {
  .sheet-foot { padding-left: var(--s3); padding-right: var(--s3); }
  .sheet-foot .sheet-actions { gap: var(--s1); }
  .sheet-foot .btn-primary, .sheet-foot .btn-secondary { padding: 0 var(--s1); font-size: 11.5px; }
}
/* 広い画面では、本の紹介を広く、表紙を大きく */
@media (min-width: 900px) {
  .sheet { max-width: 720px; }
  .book-detail { grid-template-columns: 160px 1fr; gap: var(--s5); }
  .book-cover { width: 160px; }
}
.basket-hint { margin: var(--s1) 0 0; font-size: 11px; line-height: 1.6; color: var(--ink-dim); }
.basket-hint[hidden] { display: none; }
.btn-primary, .btn-secondary {
  flex: 1; display: inline-grid; place-items: center; min-height: 46px; padding: 0 var(--s4);
  border-radius: 2px; font-size: 14px; letter-spacing: .1em; text-decoration: none;
}
.btn-primary { background: var(--shu); color: var(--on-shu); border: 0; }
.btn-primary:active { background: var(--shu-press); }
.btn-primary.in, .btn-primary.in:hover, .btn-primary.in:active { background: none; color: var(--shu); border: 1px solid var(--shu); cursor: default; }
.btn-secondary { border: 1px solid var(--ink); color: var(--ink); background: none; }
.btn-secondary:active { background: rgba(42,34,27,.06); }
.sheet-close {
  display: block; margin: var(--s4) auto 0; background: none; border: 0; padding: var(--s2) var(--s4);
  font-size: 13px; color: var(--ink-dim); letter-spacing: .12em;
}
.sheet-close:hover { color: var(--ink); }
.sheet-close.top { margin: 0; min-height: 40px; padding: 0 0 0 var(--s4); }

.basket-list { list-style: none; margin: 0; padding: 0; }
.basket-list li { display: grid; grid-template-columns: 44px 1fr auto; gap: var(--s3); align-items: center; padding: var(--s3) 0; border-bottom: 1px solid var(--paper-line); }
.basket-list img { width: 44px; aspect-ratio: 105/148; object-fit: contain; object-position: center top; display: block; background: var(--paper-deep); }
.basket-list .bt { font-family: var(--mincho); font-weight: 600; font-size: 14px; line-height: 1.5; }
.basket-list .ba { font-size: 12px; color: var(--ink-dim); }
.basket-list .acts { display: flex; flex-direction: column; align-items: flex-end; gap: var(--s1); font-size: 12px; }
.basket-list .acts a { color: var(--ink); white-space: nowrap; }
.basket-list .acts button { background: none; border: 0; padding: 0; color: var(--ink-dim); font-size: 12px; }
.basket-list .to-shelf {
  margin-top: 2px; background: none; border: 0; padding: 0; font-size: 12px; color: var(--ink);
  text-decoration: underline; text-decoration-color: var(--paper-under); text-underline-offset: 3px;
}
.basket-list .to-shelf:hover { text-decoration-color: var(--ink); }
.basket-list .acts button:hover { color: var(--ink); }
.basket-empty { font-size: 13px; color: var(--ink-dim); line-height: 1.9; margin: var(--s2) 0 0; }
.basket-note { margin: var(--s4) 0 0; font-size: 12px; color: var(--ink-dim); line-height: 1.8; }
.basket-note[hidden] { display: none; }
/* このお店について */
.about { font-size: 14px; line-height: 1.9; letter-spacing: .03em; }
.about p { margin: 0 0 var(--s4); }
.about h3 { margin: var(--s5) 0 var(--s1); font-family: var(--mincho); font-size: 15px; font-weight: 600; letter-spacing: .1em; }
.about a { color: var(--ink); text-underline-offset: 3px; }
/* カゴから出したあとの「戻す」 */
.basket-toast {
  position: sticky; bottom: 0; z-index: 1; margin-top: var(--s4);
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: var(--s3) var(--s4); background: var(--ink); color: var(--paper); font-size: 13px;
}
.basket-toast[hidden] { display: none; }
.basket-toast span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.basket-toast button { flex: none; min-height: 32px; padding: 0 var(--s3); background: none; border: 1px solid var(--lamp-dim); border-radius: 2px; color: var(--paper); }

/* 触れたときの色の変化は、マウスのときだけ(指で押したあと色が残らないように) */
@media (hover: hover) {
  .spine:hover { filter: brightness(1.12); }
  .guide-rows button:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
  .vols-list button:hover { border-color: var(--ink); }
  .btn-primary:hover { background: var(--shu-press); }
  .btn-secondary:hover { background: rgba(42,34,27,.06); }
  .guide-btn:hover { color: var(--lamp); border-color: var(--lamp-dim); }
  .basket-toast button:hover { border-color: var(--paper); }
  .guide-tabs button:hover { color: var(--ink); }
  .guide-authors button:hover { color: var(--ink); border-bottom-color: var(--ink); }
  .track:hover i { background: var(--lamp); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
