body { min-height: 100vh; }
.lib-head {
  display: flex; align-items: center; gap: 8px; padding: 14px 28px;
  position: sticky; top: 0; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px); z-index: 10; border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.brand img { width: 30px; height: 30px; }
.spacer { flex: 1; }
main { max-width: 1180px; margin: 0 auto; padding: 24px 28px 60px; }

.prefs { max-width: 1124px; margin: 16px auto 0; padding: 8px 18px; }
.pref { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.pref:last-child { border-bottom: 0; }
.pref input { margin-top: 4px; accent-color: var(--accent); }
.pref small { color: var(--muted); }
.pref > span { flex: 1; }
#file-access-row { cursor: default; align-items: center; }
.prefs-foot { margin: 0; padding: 10px 0 6px; text-align: right; font-size: 12.5px; }
.prefs-foot a { color: var(--muted); text-decoration: none; }
.prefs-foot a:hover, .prefs-foot a:focus-visible { color: var(--accent); text-decoration: underline; }
.pref > .status-dot, .status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.status-dot.on { background: #3b9a5b; }
.status-dot.off { background: #d08a2c; }

.dropzone {
  border: 2px dashed var(--border); border-radius: 16px; padding: 28px; text-align: center;
  color: var(--muted); transition: border-color .15s, background .15s;
}
.dropzone svg { width: 34px; height: 34px; color: var(--accent); }
.dropzone h2 { color: var(--text); margin: 6px 0 4px; font-size: 18px; }
.dropzone p { margin: 0; }
.dropzone.compact { display: flex; align-items: center; gap: 14px; text-align: left; padding: 14px 20px; }
.dropzone.compact h2 { font-size: 15px; margin: 0; }
.dropzone.compact svg { width: 24px; height: 24px; }
.dropzone.big { padding: 80px 28px; margin-top: 8vh; }
.linklike { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; font-weight: 600; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 34px 2px 14px; }
.section-head h2 { font-size: 15px; margin: 0; }
#lib-stats { color: var(--muted); font-size: 12.5px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 28px 22px; }
.book {
  position: relative; display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: inherit;
  border-radius: 10px; outline-offset: 4px;
}
.cover {
  position: relative; aspect-ratio: 2 / 3; border-radius: 6px; overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,.12), 0 8px 22px rgba(20,20,40,.14);
  transition: transform .18s, box-shadow .18s; background: var(--surface-2);
}
.book:hover .cover { transform: translateY(-3px); box-shadow: 0 2px 4px rgba(0,0,0,.12), 0 14px 30px rgba(20,20,40,.2); }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover .gen {
  position: absolute; inset: 0; padding: 18px 14px; display: flex; flex-direction: column; justify-content: space-between;
  color: #fff; font-family: Georgia, "Iowan Old Style", serif;
}
.cover .gen .gt { font-size: 17px; line-height: 1.2; font-weight: 600; }
.cover .gen .ga { font-size: 12px; opacity: .85; font-family: var(--ui-font); }
.cover .gen::before { content: ""; position: absolute; left: 10px; top: 0; bottom: 0; width: 1px; background: rgba(255,255,255,.25); }
.cover .bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(0,0,0,.25); }
.cover .bar div { height: 100%; background: var(--accent); }
.meta .t { font-weight: 600; font-size: 13.5px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta .a { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meta .s { color: var(--muted); font-size: 11.5px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.remove {
  position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border-radius: 50%;
  border: 0; background: rgba(20,20,25,.72); color: #fff; display: grid; place-items: center;
  opacity: 0; cursor: pointer; transition: opacity .15s;
}
.remove svg { width: 16px; height: 16px; }
.book:hover .remove, .remove:focus-visible { opacity: 1; }
.confirm {
  position: absolute; inset: 0; border-radius: 6px; background: rgba(20,20,25,.86); color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 12px; text-align: center;
  font-size: 13px;
}
.confirm .row { display: flex; gap: 8px; }
.confirm button { border: 0; border-radius: 8px; padding: 6px 12px; cursor: pointer; font-weight: 600; }
.confirm .yes { background: #d9563f; color: #fff; }
.confirm .no { background: rgba(255,255,255,.15); color: #fff; }

#drop-overlay {
  position: fixed; inset: 0; z-index: 70; display: none; place-items: center;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  border: 3px dashed var(--accent); border-radius: 18px; margin: 10px;
  color: var(--accent); font-weight: 600; font-size: 18px; text-align: center;
}
#drop-overlay svg { width: 40px; height: 40px; }
body.dragging #drop-overlay { display: grid; }
.import-error { margin-top: 14px; padding: 12px 16px; border-radius: 10px; background: rgba(180,65,47,.1); color: var(--danger); }
