:root {
  --accent: #7c2d12; --accent2: #b45309; --bg: #faf6f0; --card: #fffdf9;
  --text: #3f2a1e; --muted: #8a7a6d; --border: #e7ddd0; --paper: #fbf7ef;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif; background: var(--bg); color: var(--text); }
.view { display: none; } .view.is-active { display: block; }

/* 書棚 */
.lib-header { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; padding: calc(env(safe-area-inset-top) + 16px) 16px 16px; }
.lib-header h1 { margin: 0; font-size: 1.35rem; }
.lib-header .sub { margin: 4px 0 0; font-size: .82rem; opacity: .9; }
#library main { max-width: 720px; margin: 0 auto; padding: 12px 12px calc(24px + env(safe-area-inset-bottom)); }
.resume-bar { max-width: 720px; margin: 12px auto 0; padding: 0 12px; }
.resume-btn { width: 100%; padding: 12px; border: none; border-radius: 12px; background: var(--accent); color: #fff; font-weight: 700; font-size: 1rem; cursor: pointer; }
.shelf-label { font-size: .9rem; color: var(--muted); margin: 18px 4px 8px; font-weight: 700; }
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
.book {
  position: relative; display: flex; flex-direction: column; justify-content: flex-end;
  aspect-ratio: 3/4; padding: 10px; border: none; border-radius: 4px 8px 8px 4px; cursor: pointer;
  background: linear-gradient(105deg, #fff 0 8px, #8b3a1a 8px 12px, #a9542c 12px 100%);
  color: #fff; text-align: left; box-shadow: 2px 3px 8px rgba(63,42,30,.25); overflow: hidden;
}
.book-title { font-weight: 800; font-size: .82rem; line-height: 1.2; text-shadow: 0 1px 2px rgba(0,0,0,.3); }
.book-meta { font-size: .66rem; opacity: .85; margin-top: 4px; }
.book-wip { filter: grayscale(.6) opacity(.55); cursor: default; }
.read-badge { position: absolute; top: 6px; right: 6px; background: #fbbf24; color: #422006; border-radius: 999px; min-width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; font-size: .7rem; font-weight: 800; padding: 0 5px; }
.empty { color: var(--muted); font-size: .9rem; padding: 8px 4px; }

/* リーダー */
.reader-header { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px; background: var(--card); border-bottom: 1px solid var(--border); padding: calc(env(safe-area-inset-top) + 8px) 12px 8px; }
.icon-btn { border: none; background: transparent; font-size: 1.3rem; cursor: pointer; color: var(--accent); }
.reader-title { flex: 1; font-weight: 700; font-size: 1rem; }
.reader-progress { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.reader-scroll { height: calc(100vh - 52px - env(safe-area-inset-top)); overflow-y: auto; background: var(--paper); }
#reader .reader-scroll { padding: 20px 20px calc(40px + env(safe-area-inset-bottom)); max-width: 720px; margin: 0 auto; }
#chapter-title { font-size: 1.3rem; margin: 0 0 18px; color: var(--accent); }
.chapter-body p { font-size: 1.08rem; line-height: 2; margin: 0 0 1.1em; text-align: justify; }
.chapter-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }
.nav-btn { flex: 1; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); color: var(--accent); font-weight: 700; font-size: .95rem; cursor: pointer; font-family: inherit; }
