/* Letture: sto leggendo, sfida, statistiche (pagina #/letture) */
.lib-page { display: flex; flex-direction: column; gap: 1.4rem; }
.lib-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.lib-year { display: flex; flex-direction: column; gap: .2rem; }
.lib-year .select { min-width: 6.5rem; }
.lib-section { display: flex; flex-direction: column; gap: .8rem; }
.lib-card { padding: 1.1rem 1.2rem; display: flex; flex-direction: column; gap: .8rem; }
.lib-card h3, .lib-chart-block h3, .lib-cols h3 { font-size: .95rem; font-weight: 700; margin: 0 0 .4rem; }
.lib-h { font-size: 1.1rem; font-weight: 750; margin: 0; display: flex; align-items: center; gap: .45rem; }

.lib-list { display: flex; flex-direction: column; gap: .8rem; }
.lib-item { display: grid; grid-template-columns: 84px 1fr; gap: 1rem; padding: 1rem; background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; }
.lib-cover { display: block; aspect-ratio: 2 / 3; border-radius: 6px; overflow: hidden; background: var(--sage); }
.lib-cover img, .lib-cover > * { width: 100%; height: 100%; object-fit: cover; display: block; }
.lib-body { min-width: 0; display: flex; flex-direction: column; gap: .45rem; }
.lib-body h3 { font-size: 1.05rem; margin: 0; }
.lib-body p { margin: 0; }
.lib-progress { height: 8px; border-radius: 4px; background: var(--sage); overflow: hidden; }
.lib-progress > span { display: block; height: 100%; background: var(--forest); border-radius: 4px; }
.lib-inline-form { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.lib-inline-form input { width: 6.5rem; min-height: 44px; }
.lib-inline-form .btn, .lib-actions .btn, .lib-mini .btn, .lib-add .btn, .lib-goal-actions .btn { min-height: 44px; }
.lib-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.lib-goal-text { font-size: 1.05rem; font-weight: 650; margin: 0; }
.lib-goal-actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }

.lib-add { display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-start; }
.lib-add-fields { display: flex; gap: .5rem; flex-wrap: wrap; flex: 1 1 18rem; }
.lib-add-fields input { flex: 1 1 9rem; min-height: 44px; }

.lib-shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .9rem; }
.lib-mini { display: flex; flex-direction: column; gap: .3rem; }
.lib-mini h3 { font-size: .9rem; margin: .2rem 0 0; line-height: 1.25; }
.lib-mini p { margin: 0; }

.lib-facts { display: flex; gap: 1.6rem; flex-wrap: wrap; }
.lib-fact { display: flex; flex-direction: column; }
.lib-fact strong { font-size: 1.6rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.lib-fact span { color: var(--ink-2); font-size: .84rem; }
.lib-stats { display: flex; flex-direction: column; gap: 1.2rem; }
.lib-chart { width: 100%; max-width: 520px; height: auto; display: block; }
.lib-chart .axis { stroke: var(--rule-strong); stroke-width: 1; }
.lib-chart .bar { fill: var(--forest); }
.lib-chart .bar-rating { fill: var(--amber); }
.lib-chart text { fill: var(--ink-2); font-size: 10px; font-variant-numeric: tabular-nums; }
.lib-chart .val { fill: var(--ink); font-weight: 650; }
.lib-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; }
.lib-hbars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.lib-hbars li { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: 'name num' 'track track'; gap: .15rem .6rem; font-size: .88rem; }
.lib-hbar-name { grid-area: name; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-hbar-num { grid-area: num; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.lib-hbar-track { grid-area: track; height: 6px; border-radius: 3px; background: var(--sage); overflow: hidden; }
.lib-hbar-track > span { display: block; height: 100%; background: var(--forest); border-radius: 3px; }
.lib-longest { margin: 0; font-size: .92rem; }
.lib-all > summary { cursor: pointer; font-weight: 650; min-height: 44px; display: flex; align-items: center; }
.lib-all[open] > summary { margin-bottom: .6rem; }

/* Profilo */
.now-reading { display: flex; align-items: flex-start; gap: .4rem; margin: 0 0 .4rem; color: var(--ink-2); }
.now-reading svg { flex: none; margin-top: .1rem; color: var(--forest); }
.lib-link { color: var(--forest); font-weight: 650; text-decoration: none; }
.lib-link:hover { text-decoration: underline; }

@media (max-width: 720px) {
  .lib-item { grid-template-columns: 68px 1fr; padding: .8rem; }
  .lib-cols { grid-template-columns: 1fr; }
  .lib-inline-form input { width: 5.5rem; }
}

/* La regola generale dei campi (style.css, input:not(...)) vale di più: qui va battuta con la stessa forma */
.lib-inline-form input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]) { width: 6.5rem; flex: 0 0 auto; }
@media (max-width: 720px) {
  .lib-inline-form input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]) { width: 5.5rem; }
}
