/* ============================================================
   도서관(영어도서관 / 러시아어도서관) — 2026-11-22. 비즈영어·루스키 공용 파일.
   표지 중심: 글자보다 그림이 먼저 보이게. 모바일 우선, 1024 / 768 / 480 대응.
   포인트 색은 --lib-accent (비즈영어 기본 레드, 루스키는 index.html에서 블루로 지정)
   ============================================================ */
#libraryPage { --lib-accent: #b91c1c; --lib-ink: #1c1917; --lib-sub: #78716c; --lib-line: #e7e5e4; --lib-paper: #fffdf8; background: #faf8f3; }
#libraryPage.lib-reading { background: #f3efe6; }
.lib-wrap { max-width: 1120px; margin: 0 auto; padding: 108px 20px 64px; color: var(--lib-ink); }
.lib-reading .lib-wrap { max-width: 980px; padding: 96px 16px 24px; }

.lib-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.lib-title { font-size: 28px; font-weight: 800; margin: 0 0 6px; letter-spacing: -0.02em; text-wrap: balance; }
.lib-title span { font-size: 14px; font-weight: 600; color: var(--lib-sub); margin-left: 8px; letter-spacing: 0.04em; }
.lib-desc { margin: 0; font-size: 14.5px; color: var(--lib-sub); line-height: 1.6; max-width: 60ch; }
.lib-streak { flex: none; font-size: 13px; color: var(--lib-sub); padding: 8px 14px; border: 1px solid var(--lib-line); border-radius: 999px; background: #fff; }
.lib-streak b { font-size: 17px; color: var(--lib-accent); margin-right: 3px; font-variant-numeric: tabular-nums; }

.lib-notice { font-size: 13.5px; line-height: 1.6; color: #57534e; background: #fff; border: 1px solid var(--lib-line); border-left: 3px solid var(--lib-accent); padding: 10px 14px; margin-bottom: 14px; }
.lib-notice-admin { border-left-color: #a16207; background: #fefce8; color: #713f12; }

.lib-tabs { display: flex; gap: 6px; overflow-x: auto; margin: 22px 0 8px; border-bottom: 1px solid var(--lib-line); scrollbar-width: none; }
.lib-tabs::-webkit-scrollbar { display: none; }
.lib-tab { flex: none; appearance: none; background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 16px 11px; font: inherit; font-size: 16px; font-weight: 700; color: var(--lib-sub); cursor: pointer; text-align: left; min-height: 48px; }
.lib-tab small { display: block; font-size: 11.5px; font-weight: 500; color: #a8a29e; margin-top: 2px; }
.lib-tab:hover { color: var(--lib-ink); }
.lib-tab.active { color: var(--lib-ink); border-bottom-color: var(--lib-accent); }
.lib-div-meta { font-size: 12.5px; color: #a8a29e; margin-bottom: 6px; }

/* 서가 = 책이 올라가 있는 선반 한 줄 */
.lib-shelf { margin-top: 22px; }
.lib-shelf-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.lib-shelf-head h3 { font-size: 18px; font-weight: 800; margin: 0; }
.lib-shelf-head a { font-size: 13px; color: var(--lib-sub); text-decoration: none; white-space: nowrap; }
.lib-shelf-head a:hover { color: var(--lib-accent); }
.lib-row { display: flex; gap: 18px; overflow-x: auto; padding: 6px 4px 14px; align-items: flex-end; border-bottom: 6px solid #e2d9c8; box-shadow: 0 7px 8px -8px rgba(68, 51, 22, 0.35); scroll-snap-type: x proximity; }
.lib-row .lib-card { flex: none; width: 138px; scroll-snap-align: start; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)); gap: 24px 18px; margin-top: 16px; }
/* 서가 책 목록 쪽 번호(50권씩) */
.lib-pager { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 18px; }
.lib-page-btn { min-width: 36px; height: 36px; padding: 0 10px; border: 1px solid var(--lib-line); background: #fff; color: inherit; font-size: 14px; font-weight: 700; border-radius: 6px; cursor: pointer; }
.lib-page-btn:hover { border-color: var(--lib-accent); color: var(--lib-accent); }
.lib-page-btn.active { background: var(--lib-accent); border-color: var(--lib-accent); color: #fff; }
.lib-shelf > .lib-grid { align-items: start; padding-bottom: 14px; border-bottom: 6px solid #e2d9c8; box-shadow: 0 7px 8px -8px rgba(68, 51, 22, 0.35); }

.lib-card { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: inherit; min-width: 0; }
.lib-cover { position: relative; display: block; aspect-ratio: 3 / 4; background: #ece7dc; border-radius: 3px 6px 6px 3px; overflow: hidden; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06), 2px 4px 10px rgba(68, 51, 22, 0.22); transition: transform 0.18s ease, box-shadow 0.18s ease; }
.lib-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lib-cover-none { display: flex; align-items: center; justify-content: center; height: 100%; padding: 12px; font-size: 14px; font-weight: 700; text-align: center; line-height: 1.35; color: #57534e; background: linear-gradient(160deg, #f1ebdd, #e3dac6); overflow-wrap: anywhere; }
.lib-card:hover .lib-cover, .lib-card:focus-visible .lib-cover { transform: translateY(-4px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06), 4px 10px 18px rgba(68, 51, 22, 0.28); }
.lib-card:focus-visible { outline: 2px solid var(--lib-accent); outline-offset: 4px; border-radius: 4px; }
.lib-lock, .lib-done { position: absolute; left: 6px; bottom: 6px; font-size: 11px; font-weight: 700; padding: 3px 7px; border-radius: 3px; background: rgba(28, 25, 23, 0.78); color: #fff; }
.lib-done { left: auto; right: 6px; background: var(--lib-accent); }
.lib-card-title { font-size: 14px; font-weight: 700; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.lib-card-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--lib-sub); }
.lib-lv { font-size: 11px; font-weight: 800; padding: 2px 6px; border-radius: 3px; color: #fff; background: #57534e; font-variant-numeric: tabular-nums; }
.lib-lv-1 { background: #15803d; } .lib-lv-2 { background: #0f766e; } .lib-lv-3 { background: #1d4ed8; } .lib-lv-4 { background: #6d28d9; }

.lib-empty { padding: 44px 16px; text-align: center; font-size: 14.5px; color: var(--lib-sub); line-height: 1.7; }
.lib-pando:empty { display: none; }   /* 안내 캐릭터 판도 자리 — 이미지 파일을 받으면 채운다 */
.lib-waiting { margin-top: 26px; font-size: 13px; color: #a8a29e; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.lib-waiting span { border: 1px dashed #d6d3d1; padding: 3px 9px; border-radius: 3px; color: var(--lib-sub); }
.lib-foot { margin-top: 44px; padding-top: 14px; border-top: 1px solid var(--lib-line); font-size: 13px; }
.lib-foot a, .lib-back { color: var(--lib-sub); text-decoration: none; }
.lib-foot a:hover, .lib-back:hover { color: var(--lib-accent); }
.lib-back { display: inline-block; font-size: 14px; margin-bottom: 14px; padding: 6px 0; }
.lib-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.lib-chip { appearance: none; font: inherit; font-size: 13px; padding: 7px 12px; border: 1px solid var(--lib-line); background: #fff; color: #57534e; border-radius: 3px; cursor: pointer; min-height: 36px; }
.lib-chip.active { background: var(--lib-ink); border-color: var(--lib-ink); color: #fff; }

.lib-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 20px; border: 1px solid #d6d3d1; background: #fff; color: var(--lib-ink); font-size: 15px; font-weight: 700; border-radius: 4px; text-decoration: none; cursor: pointer; }
.lib-btn:hover { border-color: var(--lib-ink); }
.lib-btn-main { background: var(--lib-accent); border-color: var(--lib-accent); color: #fff; }
.lib-btn-main:hover { filter: brightness(0.93); border-color: var(--lib-accent); }

/* 책 상세 */
.lib-detail { display: grid; grid-template-columns: 260px 1fr; gap: 36px; align-items: start; }
.lib-detail-cover { aspect-ratio: 3 / 4; background: #ece7dc; border-radius: 3px 8px 8px 3px; overflow: hidden; box-shadow: 4px 10px 24px rgba(68, 51, 22, 0.26); }
.lib-detail-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lib-detail-where { font-size: 12.5px; color: var(--lib-sub); letter-spacing: 0.02em; }
.lib-detail-title { font-size: 30px; font-weight: 800; line-height: 1.2; margin: 6px 0 4px; letter-spacing: -0.02em; text-wrap: balance; overflow-wrap: anywhere; }
.lib-detail-ko { font-size: 16px; color: #57534e; }
.lib-detail-by { font-size: 13.5px; color: var(--lib-sub); margin-top: 6px; }
.lib-facts { display: grid; grid-template-columns: repeat(4, auto); justify-content: start; gap: 0 28px; margin: 20px 0; padding: 14px 0; border-top: 1px solid var(--lib-line); border-bottom: 1px solid var(--lib-line); }
.lib-facts dt { font-size: 11.5px; color: #a8a29e; margin-bottom: 3px; }
.lib-facts dd { margin: 0; font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.lib-facts small { font-size: 12px; font-weight: 500; color: var(--lib-sub); }
.lib-detail-sum { font-size: 15px; line-height: 1.75; color: #44403c; margin: 0 0 16px; max-width: 62ch; }
.lib-keys { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 22px; }
.lib-keys span { font-size: 12px; color: #a8a29e; margin-right: 4px; }
.lib-keys b { font-size: 14px; font-weight: 600; padding: 4px 10px; background: #fff; border: 1px solid var(--lib-line); border-radius: 3px; }
.lib-eps { margin-top: 32px; }
.lib-eps h3 { font-size: 16px; margin: 0 0 8px; }
.lib-ep { display: grid; grid-template-columns: 56px 1fr auto; gap: 10px; align-items: center; padding: 13px 4px; border-top: 1px solid var(--lib-line); text-decoration: none; color: inherit; min-height: 48px; }
.lib-ep:hover b { color: var(--lib-accent); }
.lib-ep small { color: var(--lib-sub); font-size: 12.5px; }
.lib-ep.is-done { color: #a8a29e; }

/* 리더 — 한 화면 = 그림 1장 + 글 */
.lib-reader { display: flex; flex-direction: column; background: var(--lib-paper); border: 1px solid #e2d9c8; border-radius: 8px; box-shadow: 0 10px 30px rgba(68, 51, 22, 0.12); height: calc(100vh - 124px); height: calc(100dvh - 124px); min-height: 460px; overflow: hidden; }
.lib-rd-top { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid #efe9db; }
.lib-rd-x { flex: none; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; font-size: 20px; color: #57534e; text-decoration: none; border-radius: 6px; }
.lib-rd-x:hover { background: #f3efe6; }
.lib-rd-name { flex: 1; min-width: 0; font-size: 14.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-rd-name small { font-weight: 500; color: var(--lib-sub); margin-left: 6px; }
.lib-rd-count { flex: none; font-size: 13px; color: var(--lib-sub); font-variant-numeric: tabular-nums; padding-right: 6px; }
.lib-rd-bar { height: 3px; background: #efe9db; }
.lib-rd-bar i { display: block; height: 100%; background: var(--lib-accent); transition: width 0.25s ease; }

.lib-rd-stage { position: relative; flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; align-items: center; padding: 18px 28px 22px; gap: 18px; -webkit-overflow-scrolling: touch; }
.lib-rd-img { flex: 1 1 55%; min-height: 220px; width: 100%; display: flex; align-items: center; justify-content: center; }
.lib-rd-img img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; }
.lay-image_full .lib-rd-img { flex-basis: 72%; }
.lib-rd-text { flex: 0 0 auto; width: 100%; max-width: 34em; font-family: Georgia, 'Iowan Old Style', 'Times New Roman', 'Noto Serif KR', serif; font-size: 23px; line-height: 1.7; color: #1c1917; }
.lib-rd-text p { margin: 0 0 0.55em; }
.lib-rd-text p:last-child { margin-bottom: 0; }
.lay-text_only { justify-content: center; }
.lay-text_only .lib-rd-text { margin: auto 0; }
/* 유치부·초등은 큰 글씨와 넉넉한 줄 간격 */
.div-kinder .lib-rd-text { font-size: 31px; line-height: 1.75; text-align: center; font-family: 'Trebuchet MS', 'Segoe UI', 'Noto Sans KR', sans-serif; }
.div-elem-lower .lib-rd-text { font-size: 27px; font-family: 'Trebuchet MS', 'Segoe UI', 'Noto Sans KR', sans-serif; }
.div-elem-upper .lib-rd-text { font-size: 24px; }
.is-article .lib-rd-text { font-size: 19.5px; max-width: 40em; }
.lib-w { cursor: pointer; border-radius: 4px; padding: 1px 1px; margin: 0 -1px; transition: background 0.12s ease; }
.lib-w:hover { background: #f1ead9; }
.lib-w.on { background: #fde68a; box-shadow: 0 0 0 2px #fde68a; }
.lib-rd-trans { margin-top: 14px; padding-top: 12px; border-top: 1px dashed #d6d3d1; font-family: 'Noto Sans KR', 'Malgun Gothic', sans-serif; font-size: 15px; line-height: 1.7; color: #57534e; }

.lib-rd-ctrl { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-top: 1px solid #efe9db; background: #fff; }
.lib-rd-nav { appearance: none; width: 56px; height: 52px; border: 1px solid #d6d3d1; background: #fff; border-radius: 8px; font-size: 30px; line-height: 1; color: var(--lib-ink); cursor: pointer; }
.lib-rd-nav:hover:not(:disabled) { border-color: var(--lib-ink); }
.lib-rd-nav:disabled { opacity: 0.3; cursor: default; }
#libRdNext:not(:disabled) { background: var(--lib-ink); border-color: var(--lib-ink); color: #fff; }
.lib-rd-tools { display: flex; gap: 8px; align-items: center; }
.lib-rd-play, .lib-rd-rate, .lib-rd-ko { appearance: none; font: inherit; min-height: 46px; padding: 0 16px; border: 1px solid #d6d3d1; background: #fff; border-radius: 8px; font-size: 14.5px; font-weight: 700; color: var(--lib-ink); cursor: pointer; }
.lib-rd-play { min-width: 84px; background: var(--lib-accent); border-color: var(--lib-accent); color: #fff; }
.lib-rd-play.active { background: #fff; color: var(--lib-accent); }
.lib-rd-play:disabled { opacity: 0.35; cursor: default; }
.lib-rd-rate { font-variant-numeric: tabular-nums; min-width: 64px; }
.lib-rd-ko.active { background: var(--lib-ink); border-color: var(--lib-ink); color: #fff; }
.lib-rd-ko.hidden { display: none; }
.lib-rd-nav:focus-visible, .lib-rd-play:focus-visible, .lib-rd-rate:focus-visible, .lib-rd-ko:focus-visible, .lib-btn:focus-visible, .lib-tab:focus-visible, .lib-chip:focus-visible { outline: 2px solid var(--lib-accent); outline-offset: 2px; }

/* 단어 팝업 */
.lib-pop { position: absolute; z-index: 5; min-width: 180px; max-width: 280px; background: #1c1917; color: #fff; border-radius: 8px; padding: 12px 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28); font-family: 'Noto Sans KR', 'Malgun Gothic', sans-serif; }
.lib-pop-word { font-size: 18px; font-weight: 800; }
.lib-pop-word small { font-size: 12.5px; font-weight: 500; color: #d6d3d1; margin-left: 4px; }
.lib-pop-mean { font-size: 14px; line-height: 1.5; color: #f5f5f4; margin-top: 4px; }
.lib-pop-mean i { color: #a8a29e; font-size: 12px; }
.lib-pop-mean small { display: block; color: #a8a29e; font-size: 12px; margin-top: 2px; }
.lib-pop-act { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.lib-pop-act button { appearance: none; font: inherit; font-size: 13px; font-weight: 700; min-height: 36px; padding: 0 12px; border-radius: 6px; border: 1px solid #57534e; background: transparent; color: #fff; cursor: pointer; }
.lib-pop-act button:hover { background: #292524; }
.lib-pop-act button.done { border-color: #15803d; color: #86efac; }

/* 마지막 장: 다 읽음 + 크레딧 */
.lib-rd-stage.is-credits { justify-content: flex-start; }
.lib-credits { width: 100%; max-width: 620px; margin: 0 auto; padding: 12px 0; }
.lib-credits h3 { font-size: 22px; font-weight: 800; margin: 8px 0 14px; text-align: center; }
.lib-credits-act { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 26px; }
.lib-credits-list { margin: 0; border-top: 1px solid var(--lib-line); }
.lib-credits-list > div { display: grid; grid-template-columns: 84px 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--lib-line); font-size: 13.5px; line-height: 1.6; }
.lib-credits-list dt { color: #a8a29e; }
.lib-credits-list dd { margin: 0; color: #44403c; overflow-wrap: anywhere; }
.lib-credits-list a { color: var(--lib-accent); }

/* 출처와 라이선스 */
.lib-src { margin-top: 26px; }
.lib-src h3 { font-size: 16px; margin: 0 0 6px; }
.lib-src ul { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--lib-line); }
.lib-src li { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; padding: 10px 0; border-bottom: 1px solid var(--lib-line); font-size: 14px; }
.lib-src li span { color: var(--lib-sub); font-size: 13px; }
.lib-src li a { color: var(--lib-accent); font-size: 13px; text-decoration: none; overflow-wrap: anywhere; }
.lib-src li em { flex-basis: 100%; font-style: normal; font-size: 12.5px; color: var(--lib-sub); }

@media (max-width: 1024px) {
  .lib-detail { grid-template-columns: 220px 1fr; gap: 28px; }
}
@media (max-width: 768px) {
  .lib-wrap { padding: 92px 16px 48px; }
  .lib-reading .lib-wrap { padding: 84px 8px 8px; }
  .lib-reader { height: calc(100vh - 96px); height: calc(100dvh - 96px); border-radius: 6px; }
  .lib-head { flex-direction: column; align-items: flex-start; }
  .lib-title { font-size: 24px; }
  .lib-detail { grid-template-columns: 1fr; gap: 20px; }
  .lib-detail-cover { max-width: 200px; }
  .lib-detail-title { font-size: 25px; }
  .lib-facts { grid-template-columns: repeat(2, 1fr); gap: 14px 20px; }
  .lib-row { gap: 14px; }
  .lib-row .lib-card { width: 122px; }
  .lib-grid { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 20px 14px; }
  .lib-rd-stage { padding: 14px 16px 18px; gap: 14px; }
  /* 휴대폰: 글이 길어도 그림은 줄이지 않는다 — 그림은 화면 높이의 40%까지, 글은 그 아래로 스크롤 */
  .lib-rd-img { flex: 0 0 auto; min-height: 0; }
  .lib-rd-img img { max-height: 40vh; max-height: 40dvh; }
  .lay-image_full .lib-rd-img img { max-height: 52vh; max-height: 52dvh; }
  .lib-rd-text { padding-bottom: 1.2em; }
  .lib-rd-text { font-size: 20px; }
  .div-kinder .lib-rd-text { font-size: 26px; }
  .div-elem-lower .lib-rd-text { font-size: 23px; }
  .div-elem-upper .lib-rd-text { font-size: 21px; }
  .is-article .lib-rd-text { font-size: 18px; }
}
@media (max-width: 480px) {
  .lib-row .lib-card { width: 108px; }
  .lib-tab { padding: 9px 12px 10px; font-size: 15px; }
  .lib-rd-ctrl { padding: 8px; gap: 6px; }
  .lib-rd-nav { width: 50px; }
  .lib-rd-play, .lib-rd-rate, .lib-rd-ko { padding: 0 11px; font-size: 13.5px; }
  .lib-rd-play { min-width: 66px; }
  .lib-rd-rate { min-width: 54px; }
  .lib-rd-text { font-size: 19px; }
  .div-kinder .lib-rd-text { font-size: 24px; }
  .lib-credits-list > div { grid-template-columns: 68px 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .lib-cover, .lib-rd-bar i, .lib-w { transition: none; }
}

/* 리더를 읽는 동안에는 떠 있는 상담 버튼을 숨긴다(다음 장 버튼을 가림) */
body.lib-reading-on .kakao-float-btn { display: none !important; }

/* ===== 2단계: 퀴즈 · 완독 화면 · 내 책장 (2026-11-22) ===== */
.lib-head-right { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex: none; }
.lib-btn-sm { min-height: 40px; padding: 0 14px; font-size: 13.5px; }
.lib-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin: 4px 0 8px; border-top: 1px solid var(--lib-line); border-bottom: 1px solid var(--lib-line); }
.lib-stats > div { padding: 16px 16px 14px; border-left: 1px solid var(--lib-line); }
.lib-stats > div:first-child { border-left: 0; padding-left: 0; }
.lib-stats dt { font-size: 12px; color: #a8a29e; margin-bottom: 4px; }
.lib-stats dd { margin: 0; font-size: 30px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.lib-stats small { font-size: 12.5px; font-weight: 500; color: var(--lib-sub); margin-left: 4px; }

.lib-rd-stage.is-quiz { justify-content: flex-start; }
.lib-quiz { width: 100%; max-width: 640px; margin: 0 auto; font-family: 'Noto Sans KR', 'Malgun Gothic', sans-serif; }
.lib-quiz h3 { font-size: 20px; font-weight: 800; margin: 4px 0 14px; }
.lib-quiz h3 small { font-size: 13px; font-weight: 500; color: var(--lib-sub); margin-left: 6px; }
.lib-q { padding: 16px 0 18px; border-top: 1px solid var(--lib-line); }
.lib-q-head { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: start; margin-bottom: 12px; }
.lib-q-head b { width: 28px; height: 28px; border-radius: 50%; background: var(--lib-ink); color: #fff; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.lib-q.ok .lib-q-head b { background: #15803d; }
.lib-q.no .lib-q-head b { background: #b91c1c; }
.lib-q-head p { margin: 2px 0 0; font-size: 17px; line-height: 1.55; font-weight: 600; font-family: Georgia, 'Times New Roman', 'Noto Serif KR', serif; }
.div-kinder .lib-q-head p, .div-elem-lower .lib-q-head p { font-size: 20px; font-family: 'Trebuchet MS', 'Segoe UI', 'Noto Sans KR', sans-serif; }
.lib-q-say, .lib-q-reset { appearance: none; font: inherit; font-size: 12.5px; padding: 0 10px; min-height: 32px; border: 1px solid #d6d3d1; background: #fff; border-radius: 6px; color: #57534e; cursor: pointer; }
.lib-q-choices, .lib-q-order { display: grid; gap: 8px; }
.lib-q-choices.is-ox { grid-template-columns: 1fr 1fr; }
.lib-q-choice { appearance: none; font: inherit; text-align: left; min-height: 48px; padding: 10px 14px; border: 1px solid #d6d3d1; background: #fff; border-radius: 8px; font-size: 15.5px; line-height: 1.5; color: var(--lib-ink); cursor: pointer; display: flex; gap: 10px; align-items: center; }
.lib-q-choices.is-ox .lib-q-choice { justify-content: center; font-size: 22px; font-weight: 800; min-height: 60px; }
.lib-q-choice:hover:not(:disabled) { border-color: var(--lib-ink); }
.lib-q-choice:disabled { cursor: default; color: #78716c; }
.lib-q-choice.is-right { border-color: #15803d; background: #f0fdf4; color: #14532d; font-weight: 700; }
.lib-q-choice.is-wrong { border-color: #b91c1c; background: #fef2f2; color: #7f1d1d; }
.lib-q-choice.picked { border-color: var(--lib-ink); background: #f5f5f4; }
.lib-q-order .lib-q-choice b { flex: none; width: 24px; height: 24px; border-radius: 50%; border: 1px solid #d6d3d1; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.lib-q-order .lib-q-choice.picked b { background: var(--lib-ink); border-color: var(--lib-ink); color: #fff; }
.lib-q-hint { font-size: 12.5px; color: var(--lib-sub); margin-top: 8px; display: flex; gap: 8px; align-items: center; }
.lib-q-right { margin: 10px 0 0; padding-left: 22px; font-size: 14px; line-height: 1.6; color: #14532d; }
.lib-q-pics { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.lib-q-pic { appearance: none; padding: 4px; border: 3px solid #e7e5e4; background: #fff; border-radius: 10px; cursor: pointer; min-height: 110px; font-size: 22px; font-weight: 800; }
.lib-q-pic img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; display: block; }
.lib-q-pic:hover:not(:disabled) { border-color: var(--lib-ink); }
.lib-q-pic.is-right { border-color: #15803d; }
.lib-q-pic.is-wrong { border-color: #b91c1c; opacity: 0.7; }
.lib-q-result { margin-top: 10px; font-size: 14px; line-height: 1.6; color: #44403c; }
.lib-q.ok .lib-q-result { color: #166534; }
.lib-q-score { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; padding: 18px 0 6px; border-top: 2px solid var(--lib-ink); font-size: 16px; }
.lib-q-score b { font-size: 26px; font-variant-numeric: tabular-nums; margin-right: 6px; }
.lib-q-choice:focus-visible, .lib-q-pic:focus-visible, .lib-q-say:focus-visible { outline: 2px solid var(--lib-accent); outline-offset: 2px; }

.lib-finish-note { text-align: center; font-size: 13.5px; color: var(--lib-sub); margin: -6px 0 12px; }
.lib-next { margin: 0 0 26px; }
.lib-next > span { display: block; font-size: 13px; font-weight: 700; color: var(--lib-sub); margin-bottom: 8px; }
.lib-next .lib-row { border-bottom: 0; box-shadow: none; padding-bottom: 0; }

@media (max-width: 768px) {
  .lib-stats { grid-template-columns: repeat(2, 1fr); }
  .lib-stats > div:nth-child(3) { border-left: 0; padding-left: 0; }
  .lib-stats > div:nth-child(n+3) { border-top: 1px solid var(--lib-line); }
  .lib-stats dd { font-size: 25px; }
  .lib-q-head p { font-size: 16px; }
}

/* 표지 비율을 원본 그대로(정사각형 표지가 잘리지 않게) — 표지가 없을 때만 3:4 자리 표시 */
.lib-cover { aspect-ratio: auto; }
.lib-cover img { height: auto; }
.lib-cover-none { aspect-ratio: 3 / 4; }
/* ── 디자인 표지(표지 그림이 없는 책) — 글자 크기는 표지 너비에 맞춰 변한다 ── */
.lib-dc { container-type: inline-size; position: relative; display: block; width: 100%; padding: 0; background: var(--dc, #1f3a5f); color: #f6efdc; font-weight: 400; overflow: hidden; }
.lib-dc-in { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6cqw; padding: 12cqw 10cqw; text-align: center; }
.lib-dc-title { font-family: Georgia, 'Times New Roman', 'Noto Serif', serif; font-weight: 700; line-height: 1.22; letter-spacing: 0.01em; overflow-wrap: break-word; max-width: 100%; font-size: 14px; font-size: calc(var(--fs, 10.5) * 1cqw); }
.lib-dc-author { font-style: normal; font-size: 10px; font-size: 5.4cqw; letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.85; }
.lib-dc-orn { display: block; width: 22cqw; height: 2px; background: currentColor; opacity: 0.7; position: relative; }
.lib-dc-orn::after { content: ''; position: absolute; left: 50%; top: 50%; width: 7px; height: 7px; background: currentColor; transform: translate(-50%, -50%) rotate(45deg); }
/* 모양 0: 짙은 바탕 + 안쪽 테두리 선 */
.lib-dc-v0::before { content: ''; position: absolute; inset: 5cqw; border: 1px solid rgba(246, 239, 220, 0.55); }
.lib-dc-v0::after { content: ''; position: absolute; inset: 7cqw; border: 1px solid rgba(246, 239, 220, 0.22); }
/* 모양 1: 종이 바탕 + 위아래 색 띠 */
.lib-dc-v1 { background: #f4ecd8; color: #2b2622; }
.lib-dc-v1::before, .lib-dc-v1::after { content: ''; position: absolute; left: 0; right: 0; height: 17%; background: var(--dc); }
.lib-dc-v1::before { top: 0; } .lib-dc-v1::after { bottom: 0; height: 9%; }
.lib-dc-v1 .lib-dc-orn { color: var(--dc); opacity: 1; }
.lib-dc-v1 .lib-dc-author { color: var(--dc); opacity: 1; }
/* 모양 2: 위 2/3 색면 + 아래 종이(작가 이름) */
.lib-dc-v2 { background: linear-gradient(to bottom, var(--dc) 0 70%, #f4ecd8 70% 100%); }
.lib-dc-v2 .lib-dc-in { justify-content: flex-start; padding-top: 16cqw; }
.lib-dc-v2 .lib-dc-orn { order: -1; }
.lib-dc-v2 .lib-dc-author { position: absolute; left: 8cqw; right: 8cqw; bottom: 0; height: 30%; display: flex; align-items: flex-start; justify-content: center; padding-top: 6cqw; color: #2b2622; opacity: 1; }
/* 모양 3: 왼쪽 세로 띠 + 왼쪽 맞춤 */
.lib-dc-v3 { background: #efe6d0; color: #2b2622; }
.lib-dc-v3::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 14%; background: var(--dc); }
.lib-dc-v3::after { content: ''; position: absolute; left: 17%; top: 0; bottom: 0; width: 1px; background: var(--dc); opacity: 0.6; }
.lib-dc-v3 .lib-dc-in { align-items: flex-start; text-align: left; padding-left: 24cqw; }
.lib-dc-v3 .lib-dc-orn { color: var(--dc); opacity: 1; width: 16cqw; }
.lib-dc-v3 .lib-dc-orn::after { left: 0; transform: translate(0, -50%) rotate(45deg); }
.lib-dc-v3 .lib-dc-author { color: var(--dc); opacity: 1; }
.lib-detail-cover .lib-dc { height: auto; }
/* 사진 표지: 사진 한 장(표지 높이의 3분의 1쯤)을 제목 아래(pa) 또는 위(pb)에 */
.lib-dc-ph::before, .lib-dc-ph::after { display: none; }
.lib-dc-ph .lib-dc-in { padding: 0; gap: 0; justify-content: flex-start; align-items: stretch; }
.lib-dc-ph .lib-dc-txt { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5cqw; padding: 5cqw 8cqw; text-align: center; }
.lib-cover .lib-dc-ph .lib-dc-photo, .lib-detail-cover .lib-dc-ph .lib-dc-photo, .lib-dc-ph .lib-dc-photo { flex: none; display: block; width: 100%; height: 44cqw; object-fit: cover; }
.lib-dc-ph .lib-dc-author { flex: none; display: flex; align-items: center; justify-content: center; min-height: 15cqw; padding: 0 6cqw; position: static; }
.lib-dc-ph .lib-dc-noauthor { min-height: 7cqw; }
.lib-dc-ph.lib-dc-pa { background: var(--dc); color: #f6efdc; }
.lib-dc-ph.lib-dc-pb { background: #f4ecd8; color: #2b2622; }
.lib-dc-pb .lib-dc-in::before { content: ''; flex: none; height: 6cqw; background: var(--dc); order: -3; }
.lib-dc-pb .lib-dc-photo { order: -2; }
.lib-dc-pb .lib-dc-orn, .lib-dc-pb .lib-dc-author { color: var(--dc); opacity: 1; }
.lib-dc-pb .lib-dc-author { border-top: 1px solid color-mix(in srgb, var(--dc) 35%, transparent); margin: 0 8cqw; padding: 0; }
.lib-dc-pb .lib-dc-noauthor { border-top: 0; background: var(--dc); margin: 0; min-height: 5cqw; }
.lib-detail-cover { aspect-ratio: auto; }
.lib-detail-cover img { height: auto; }

/* 학생 대시보드 '도서관 새 책' 카드 (2026-11-27) — 카드 틀은 styles.css의 .db-* */
#dbLibrarySlot.hidden { display: none; }
.db-lib-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: start; }
.db-lib-book { display: flex; flex-direction: column; gap: 6px; min-width: 0; color: inherit; text-decoration: none; }
.db-lib-cover { display: block; border-radius: 3px 6px 6px 3px; overflow: hidden; background: #ece7dc; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06), 2px 4px 10px rgba(68, 51, 22, 0.2); transition: transform 0.18s ease; }
.db-lib-cover img { width: 100%; height: auto; display: block; }
.db-lib-book:hover .db-lib-cover, .db-lib-book:focus-visible .db-lib-cover { transform: translateY(-3px); }
.db-lib-title { font-size: 13px; font-weight: 700; color: #111827; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.db-lib-meta { display: flex; }
.db-lib-note { margin-top: 12px; font-size: 12.5px; color: #94a3b8; }
@media (max-width: 1024px) { .db-lib-row { max-width: 420px; } }
@media (prefers-reduced-motion: reduce) { .db-lib-cover { transition: none; } }
