/* Creator Empires — Learning Library */

/* Controls */
.lib-controls { background: var(--white); border-radius: var(--radius); padding: 20px 22px; box-shadow: 0 2px 10px rgba(47,2,90,.08); margin-bottom: 18px; }
#lib-search { width: 100%; padding: 13px 16px; border: 2px solid #e3ddf0; border-radius: 10px; font: inherit; font-size: 15px; margin-bottom: 14px; outline: none; }
#lib-search:focus { border-color: var(--purple-light); }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.chip-row:last-child { margin-bottom: 0; }
.chip-label { font-size: 11px; font-weight: 800; text-transform: uppercase; color: #8a7fa3; min-width: 46px; letter-spacing: .5px; }
.chip { border: 0; background: #f0ecf8; color: var(--purple); font-family: var(--font-body); font-weight: 700; font-size: 12.5px; padding: 6px 13px; border-radius: 999px; cursor: pointer; transition: background .12s, color .12s; }
.chip:hover { background: #e4dbf5; }
.chip.active { background: var(--purple); color: var(--yellow); }
.lib-count { font-size: 13px; color: #8a7fa3; font-weight: 700; margin-bottom: 14px; }

/* Cards */
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px; }
.lib-card { background: var(--white); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: var(--ink); box-shadow: 0 2px 10px rgba(47,2,90,.08); transition: transform .15s ease, box-shadow .15s ease; display: flex; flex-direction: column; }
.lib-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(47,2,90,.16); }
.lib-card.lib-featured { outline: 3px solid var(--yellow); }
.lib-thumb { position: relative; aspect-ratio: 16/9; background: #2f025a; }
.lib-thumb img { width: 100%; height: 100%; object-fit: cover; }
.lib-thumb .play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 22px; color: var(--white); background: rgba(47,2,90,.25); padding-left: 4px; }
.lib-card-body { padding: 20px 22px 22px; display: flex; flex-direction: column; flex: 1; }
.lib-emoji { font-size: 26px; margin-bottom: 8px; }
.lib-card h3 { font-family: var(--font-body); font-weight: 800; text-transform: none; font-size: 17px; line-height: 1.3; margin-bottom: 6px; color: var(--purple-dark); }
.lib-meta { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: #8a7fa3; margin-bottom: 8px; }
.lib-sum { font-size: 14px; color: #555; flex: 1; }
.lib-tags { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.tag { background: #f0ecf8; color: var(--purple); font-weight: 700; font-size: 11.5px; padding: 3px 10px; border-radius: 999px; }
.tag.type { background: var(--yellow); color: var(--purple-dark); }

/* Detail pages */
.lib-detail { max-width: 820px; }
.backlink { margin-bottom: 16px; }
.backlink a { color: var(--purple); font-weight: 700; text-decoration: none; font-size: 14px; }
.detail-tags { margin-bottom: 10px; }
.video-embed { position: relative; aspect-ratio: 16/9; border-radius: var(--radius); overflow: hidden; box-shadow: 0 2px 10px rgba(47,2,90,.12); margin: 18px 0 10px; background: #000; }
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; }
.lib-detail h2 { font-size: clamp(18px, 2.4vw, 24px); margin: 30px 0 12px; color: var(--purple-dark); }
.detail-summary p { font-size: 16px; }
.takeaways ul, .chapters ul { list-style: none; }
.takeaways li { background: var(--white); border-left: 4px solid var(--yellow); border-radius: 8px; padding: 12px 16px; margin-bottom: 10px; font-size: 14.5px; box-shadow: 0 1px 6px rgba(47,2,90,.06); }
.chapters li { display: flex; gap: 14px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid #e9e4f2; font-size: 14.5px; }
.ch-ts { font-weight: 800; color: var(--purple); text-decoration: none; min-width: 58px; font-variant-numeric: tabular-nums; }
.ch-ts:hover { text-decoration: underline; }
.lib-detail a { color: var(--purple); font-weight: 700; }

/* Article body */
.article-body { background: var(--white); border-radius: var(--radius); padding: 30px 34px; margin-top: 24px; box-shadow: 0 2px 10px rgba(47,2,90,.08); }
.article-body h2 { margin-top: 26px; }
.article-body h2:first-child { margin-top: 0; }
.article-body p { margin-bottom: 13px; font-size: 15.5px; }
.article-body .li-intro { margin-bottom: 6px; font-weight: 600; }
.article-body ul { margin: 0 0 16px 22px; }
.article-body li { font-size: 15px; margin-bottom: 5px; }
@media (max-width: 640px) { .article-body { padding: 22px 18px; } }

/* Chat markdown */
.msg.bot h1, .msg.bot h2, .msg.bot h3 { font-family: var(--font-body); text-transform: none; font-size: 15px; font-weight: 800; color: var(--purple-dark); margin: 10px 0 4px; }
.msg.bot h3:first-child, .msg.bot h2:first-child { margin-top: 0; }
.msg.bot p { margin: 0 0 8px; }
.msg.bot p:last-child { margin-bottom: 0; }
.msg.bot ul, .msg.bot ol { margin: 4px 0 8px 20px; }
.msg.bot li { margin-bottom: 3px; }
.msg.bot a { color: var(--purple); font-weight: 700; }
.msg.bot strong { color: var(--purple-dark); }
.msg.bot .src { display: block; margin-top: 6px; font-size: 12.5px; color: #7a6f95; }
