/* ─── Library: browse ─────────────────────────────────────── */
.lib-continue { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 22px; border-color: color-mix(in srgb, var(--purple) 30%, var(--line)); }
.lib-continue .btn.primary { background: var(--purple); border-color: var(--purple); color: #fff; }
.lib-tools { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.lib-tools .search { flex: 1; min-width: 240px; }
.lib-cats { display: flex; gap: 8px; margin: 14px 0 6px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.lib-cats::-webkit-scrollbar { display: none; }
.lib-cats .chip { flex: none; height: 30px; padding: 0 12px; font-size: 12.5px; }
.lib-cats .chip.on .faint { color: inherit; opacity: .6; }
.lib-section { margin-top: 34px; }
.lib-section .section-head h2 { font-family: var(--serif); font-weight: 400; font-size: 26px; letter-spacing: -.01em; }
.lib-card { min-height: 200px; }
.lib-card h3 { margin-top: 22px; }
.lib-card .bar i { background: var(--purple); width: 0; }
.good-t { color: var(--good); }
.chip.type-sop { background: var(--purple-soft); color: var(--purple); border-color: transparent; }
.chip.type-template { background: var(--info-soft); color: var(--info); border-color: transparent; }

/* ─── Library: read ───────────────────────────────────────── */
.read-progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 50; pointer-events: none; }
.read-progress i { display: block; height: 100%; width: 0; background: var(--purple); transition: width .1s linear; }
.reader { display: grid; grid-template-columns: minmax(0, 720px) 220px; gap: 56px; justify-content: space-between; margin-top: 18px; }
.toc { position: sticky; top: 90px; align-self: start; display: flex; flex-direction: column; gap: 2px; max-height: calc(100vh - 120px); overflow-y: auto; }
.toc a { padding: 6px 0 6px 12px; border-left: 1px solid var(--line-2); font-size: 13px; color: var(--text-3); transition: color .2s, border-color .2s; }
.toc a:hover { color: var(--text); }
.toc a.on { color: var(--text); border-left-color: var(--purple); }
@container (max-width: 940px) { .reader { grid-template-columns: minmax(0, 1fr); } .toc { display: none; } }

.steps-card { margin-top: 22px; }
.steps-card svg { width: 15px; height: 15px; vertical-align: -2px; color: var(--purple); }
.steps-card .bar i { background: var(--purple); }
.lesson { margin-top: 26px; max-width: none; }
.lesson h2 { scroll-margin-top: 90px; padding-top: 12px; border-top: 1px solid var(--line); margin-top: 40px; }
.lesson h2:first-child { border-top: 0; margin-top: 10px; }
.lesson h3 { font-size: 16px; font-weight: 600; margin: 24px 0 10px; color: var(--text); }
.lesson .kicker { font-family: var(--mono); font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--purple); margin: -2px 0 14px; }
.lesson blockquote { border-left-color: var(--purple); }

.todo { display: grid; grid-template-columns: 22px 1fr; gap: 12px; align-items: start; padding: 14px 16px; margin: 0 0 8px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); cursor: pointer; transition: border-color .2s, background .2s; }
.todo:hover { border-color: var(--line-2); }
.todo input { position: absolute; opacity: 0; pointer-events: none; }
.todo .box { width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--line-2); display: grid; place-items: center; margin-top: 1px; transition: all .25s var(--ease-spring); }
.todo .box svg { width: 14px; height: 14px; opacity: 0; transform: scale(.5); transition: all .25s var(--ease-spring); color: #fff; }
.todo b { display: block; font-weight: 500; color: var(--text); font-size: 15px; line-height: 1.5; }
.todo small { display: block; margin-top: 5px; color: var(--text-2); font-size: 14px; line-height: 1.6; }
.todo.ticked { background: var(--purple-soft); border-color: transparent; }
.todo.ticked .box { background: var(--purple); border-color: var(--purple); }
.todo.ticked .box svg { opacity: 1; transform: none; }
.todo.ticked b { color: var(--text-2); }
.todo input:focus-visible + .box { outline: 2px solid var(--purple); outline-offset: 2px; }

.codeblock { position: relative; margin: 6px 0 20px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.codeblock pre { margin: 0; padding: 20px 22px; white-space: pre-wrap; font: 13.5px/1.75 var(--mono); color: var(--text); overflow-x: auto; }
.codeblock .btn { position: absolute; top: 10px; right: 10px; }
.tbl { overflow-x: auto; margin: 6px 0 20px; border: 1px solid var(--line); border-radius: 14px; }
.tbl table { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--text-2); }
.tbl th { color: var(--text); font-weight: 500; background: var(--surface-2); }
.tbl tr:last-child td { border-bottom: 0; }

.lesson-end { display: flex; gap: 10px; flex-wrap: wrap; margin: 40px 0 18px; padding-top: 26px; border-top: 1px solid var(--line); }
.lesson-end .btn.primary { background: var(--purple); border-color: var(--purple); color: #fff; }
.lesson-nav { margin-bottom: 20px; }
