:root { --bg: #faf7f2; --card: #ffffff; --ink: #221c18; --muted: #7a6f66; --line: #e8e1d8; --accent: #d9480f; --radius: 14px; }
@media (prefers-color-scheme: dark) { :root { --bg: #17130f; --card: #231d18; --ink: #f3ece4; --muted: #a79c92; --line: #37302a; } }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 -apple-system, system-ui, "Segoe UI", sans-serif; padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
#app { max-width: 720px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.6rem; margin: 8px 0 12px; }
h2 { font-size: 1.1rem; margin: 20px 0 8px; }
header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.muted { color: var(--muted); font-size: 0.9rem; }
p.strong { font-weight: 600; margin: 0; }
.audible-row p.muted { margin: 2px 0 0; }
a { color: inherit; text-decoration: none; }
input, textarea, select { width: 100%; padding: 12px; margin: 6px 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: inherit; font: inherit; }
textarea { min-height: 96px; resize: vertical; }
button, .button { display: inline-block; padding: 12px 16px; border: 0; border-radius: 999px; background: var(--accent); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
button.small, .button.small, .chip { padding: 8px 12px; font-size: 0.9rem; }
.chip { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.danger { background: #b42318; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 14px; }
.book { display: block; padding: 0; overflow: hidden; margin: 0; position: relative; }
.book img, .nocover { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; display: block; background: var(--line); }
.nocover { display: grid; place-items: center; padding: 8px; text-align: center; font-size: 0.85rem; color: var(--muted); }
.book .title { padding: 8px 10px 0; font-weight: 600; font-size: 0.9rem; line-height: 1.25; }
.book .muted { padding: 2px 10px 10px; }
.book .muted.left { color: var(--accent); font-weight: 600; margin-top: -8px; }
.badge { position: absolute; top: 8px; right: 8px; background: var(--accent); color: #fff; font-size: 0.7rem; padding: 3px 8px; border-radius: 999px; }
.audible { position: relative; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--card); font-size: 0.8rem; }
.audible svg { position: absolute; inset: -2px; width: 32px; height: 32px; transform: rotate(-90deg); }
.audible .track { stroke: var(--line); stroke-width: 2.5; }
.audible .arc { stroke: var(--accent); stroke-width: 2.5; }
.audible.owned span { opacity: 0.45; }
.coverwrap { position: relative; }
.book .audible { position: absolute; left: 8px; bottom: 8px; }
.audible-row { display: flex; align-items: center; gap: 12px; }
.audible-row .audible { width: 40px; height: 40px; font-size: 1.1rem; flex: none; }
.audible-row .audible svg { width: 44px; height: 44px; }
.audible-row .grow { flex: 1; min-width: 0; }
.stars { display: flex; gap: 2px; margin: 6px 0 12px; }
.star { background: none; color: var(--line); font-size: 1.8rem; padding: 0 2px; }
.star.on { color: #f5a524; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.row label { display: flex; gap: 6px; align-items: center; }
.row input[type="checkbox"] { width: auto; margin: 0; }
.photos { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.photos figure { margin: 0; flex: 0 0 120px; text-align: center; }
.photos img, .preview { width: 120px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 10px; display: block; margin: 0 auto 6px; }
.preview { width: 160px; }
details { border-top: 1px solid var(--line); padding: 10px 0; }
summary { cursor: pointer; font-weight: 600; }
details ul { margin: 8px 0 0; padding-left: 18px; }
.answer { white-space: pre-wrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--card); vertical-align: middle; }
.seg button { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 0.85rem; font-weight: 600; padding: 5px 12px; border-radius: 999px; }
.seg button.on { background: var(--ink); color: var(--bg); }
.shelf { display: flex; align-items: flex-end; gap: 4px; padding: 0 6px; height: 118px; border-bottom: 10px solid var(--line); margin-bottom: 18px; overflow-x: auto; overflow-y: hidden; }
.sp { position: relative; flex: none; border-radius: 3px 3px 0 0; border: 0; padding: 0; transform-origin: bottom left; transition: transform .25s ease; }
.sp.lean { transform: rotate(-7deg); }
.sp.open { outline: 3px solid var(--accent); outline-offset: 2px; }
.sp.up { transform: translateY(-16px); }
.sp span { position: absolute; inset: 0; writing-mode: vertical-rl; transform: rotate(180deg); font: 600 10px/1 -apple-system, system-ui, sans-serif; color: #fff; padding: 6px 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; opacity: .9; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; background: var(--card); border-top: 1px solid var(--line); border-radius: 20px 20px 0 0; padding: 14px 16px calc(18px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: 84px 1fr; gap: 14px; transform: translateY(110%); transition: transform .25s ease; z-index: 5; max-width: 720px; margin: 0 auto; }
.sheet.show { transform: none; }
.sheet img, .sheet .nocover { width: 84px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 8px; font-size: 0.7rem; }
.sheet .t { font-size: 1.15rem; font-weight: 700; line-height: 1.15; margin: 0 0 4px; }
.sheet .row { margin-top: 10px; }
.sheet a.chip { display: inline-block; }
@media (prefers-reduced-motion: reduce) { .sp, .sheet { transition: none; } }
#nav { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
#nav a { flex: 1; text-align: center; padding: 12px 4px; font-size: 0.85rem; color: var(--muted); }
#nav a.active { color: var(--accent); font-weight: 700; }
#nav[hidden], #toast[hidden], [hidden] { display: none; }
#toast .undo { background: transparent; border: 1px solid var(--bg); color: var(--bg); padding: 4px 12px; margin-left: 10px; font-size: 0.85rem; font-weight: 700; }
#toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 0.9rem; }
