:root {
  --bg: #fbfaf8;
  --panel: #ffffff;
  --ink: #2b2b2b;
  --sub: #9a9a9a;
  --line: #ececec;
  --mincho: 'Shippori Mincho', 'Yu Mincho', 'Hiragino Mincho ProN', serif;
  --gothic: 'Zen Kaku Gothic New', 'Hiragino Sans', 'Yu Gothic', sans-serif;
}
* { box-sizing: border-box; margin: 0; }
html, body { background: var(--bg); color: var(--ink); font-family: var(--gothic); }
button, input, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }

.layout { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; padding: 44px 56px 80px; }

.head { display: flex; align-items: baseline; gap: 18px; margin-bottom: 28px; flex-wrap: wrap; }
h1 { font-family: var(--mincho); font-size: 30px; font-weight: 500; letter-spacing: .2em; }
.count { font-size: 13px; color: var(--sub); }
.right { margin-left: auto; display: flex; gap: 12px; align-items: center; }
.search { border: 0; border-bottom: 1px solid #ddd; background: transparent; padding: 6px 4px; width: 220px; font-size: 13px; outline: none; }
.search:focus { border-bottom-color: var(--ink); }
.add { border: 1px solid var(--ink); border-radius: 2px; padding: 8px 18px; font-size: 13px; letter-spacing: .1em; }
.add:hover { background: var(--ink); color: var(--bg); }

.bar { display: flex; align-items: center; gap: 28px; margin-bottom: 30px; border-bottom: 1px solid #eee; }
.tab { padding: 10px 0; font-size: 14px; color: #a0a0a0; letter-spacing: .1em; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.on { color: var(--ink); border-bottom-color: var(--ink); }
.tab .n { font-size: 11px; margin-left: 6px; }
.year { margin-left: auto; font-family: var(--mincho); font-size: 15px; color: #555; border: 0; background: transparent; cursor: pointer; }

section { margin-bottom: 40px; }
.sn { display: flex; align-items: baseline; gap: 10px; margin: 0 0 14px 2px; }
.sn .m { font-family: var(--mincho); font-size: 20px; }
.sn .c { font-size: 12px; color: #aaa; }
.shelf { position: relative; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 30px 26px; padding: 8px 18px 0; }
.shelf::after { content: ""; position: absolute; left: 0; right: 0; bottom: -10px; height: 10px; background: #fff; border-top: 1px solid var(--line); box-shadow: 0 6px 12px rgba(0,0,0,.05); }

.book { width: 116px; height: 170px; position: relative; overflow: hidden; border-radius: 1px; cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 8px 16px rgba(0,0,0,.08); transition: transform .15s; background: #eee; }
.book:hover { transform: translateY(-3px); }
.book.sel { outline: 1px solid var(--ink); outline-offset: 4px; }
.book img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph { padding: 16px 12px; display: flex; flex-direction: column; justify-content: space-between; font-family: var(--mincho); width: 100%; height: 100%; }
.ph .t { font-size: 16px; font-weight: 700; line-height: 1.35; writing-mode: vertical-rl; max-height: 112px; align-self: flex-end; overflow: hidden; }
.ph .a { font-size: 10px; opacity: .85; }
.badge { position: absolute; bottom: 6px; right: 6px; font-size: 9px; background: rgba(255,255,255,.92); color: #333; padding: 1px 6px; border-radius: 2px; }

.status { color: var(--sub); font-size: 13px; padding: 20px 2px; }

.side { width: 360px; flex-shrink: 0; background: var(--panel); border-left: 1px solid #efefef; padding: 56px 40px; display: flex; flex-direction: column; align-items: center; position: sticky; top: 0; height: 100vh; }
.side[hidden] { display: none; }
.close { position: absolute; top: 14px; right: 18px; font-size: 22px; color: #aaa; }
.big { width: 168px; height: 248px; margin-bottom: 30px; box-shadow: 0 2px 4px rgba(0,0,0,.08), 0 18px 30px rgba(0,0,0,.12); overflow: hidden; }
.big img { width: 100%; height: 100%; object-fit: cover; display: block; }
.big .ph .t { font-size: 22px; max-height: 170px; }
.side h2 { font-family: var(--mincho); font-size: 22px; font-weight: 500; letter-spacing: .08em; text-align: center; line-height: 1.5; }
.side .au { color: #888; font-size: 13px; margin: 8px 0 28px; letter-spacing: .1em; }
.row { width: 100%; display: flex; justify-content: space-between; font-size: 13px; padding: 12px 0; border-top: 1px solid #f0f0f0; border-bottom: 1px solid #f0f0f0; }
.row span:first-child { color: #999; }
.want { margin-top: 24px; border: 1px solid #ddd; padding: 9px 22px; font-size: 13px; letter-spacing: .08em; color: #555; }
.want.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.from { margin-top: auto; font-size: 11px; color: #bbb; letter-spacing: .1em; }

dialog { border: 0; padding: 0; border-radius: 4px; box-shadow: 0 20px 60px rgba(0,0,0,.2); width: min(420px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(250,250,248,.7); backdrop-filter: blur(2px); }
dialog form { padding: 28px; display: flex; flex-direction: column; gap: 14px; }
dialog h3 { font-family: var(--mincho); font-weight: 500; font-size: 20px; letter-spacing: .1em; }
dialog label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: #777; }
dialog input:not([type=checkbox]) { border: 0; border-bottom: 1px solid #ddd; padding: 6px 2px; font-size: 15px; color: var(--ink); outline: none; }
dialog input:focus { border-bottom-color: var(--ink); }
dialog .check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-size: 13px; }
.hint { font-size: 11px; color: #aaa; }
.btns { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.btns button { padding: 8px 18px; font-size: 13px; border: 1px solid #ddd; }
.btns .primary { background: var(--ink); color: #fff; border-color: var(--ink); }

@media (max-width: 860px) {
  .main { padding: 28px 16px 60px; }
  .head { gap: 10px; margin-bottom: 18px; }
  h1 { font-size: 24px; }
  .right { width: 100%; margin-left: 0; }
  .search { flex: 1; width: auto; }
  .bar { gap: 20px; overflow-x: auto; }
  .shelf { gap: 22px 14px; padding: 6px 4px 0; }
  .book { width: calc((100vw - 32px - 8px - 28px) / 3); height: auto; aspect-ratio: 116 / 170; }
  .ph .t { font-size: 14px; }
  .side { position: fixed; inset: auto 0 0 0; width: 100%; height: auto; max-height: 85vh; border-left: 0; border-top: 1px solid #eee;
    border-radius: 14px 14px 0 0; padding: 32px 24px calc(24px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 40px rgba(0,0,0,.12); overflow-y: auto; z-index: 10; }
  .big { width: 120px; height: 177px; margin-bottom: 18px; }
  .from { margin-top: 18px; }
}
