/* deu-hoc-lieu.css — Kho học liệu (/learning-library, public/deu/hoc-lieu/*). Cùng khuôn /pronunciation: dải đậm + thẻ chồng mép dải.
   Chỉ token màu (tự lật nền tối). Thân bài: chữ markdown của includes/deu/hoc_lieu.php (md-h2, md-table, khung hl-box, đáp án hl-ans). */
.hl { --hl-ok: var(--color-gender-das); --hl-ok-soft: var(--color-gender-das-soft); --hl-ok-fg: var(--color-gender-das-fg);
      --hl-link: var(--lv-brand-fg); --hl-gold-soft: color-mix(in srgb, var(--color-brand-gold) 14%, var(--lv-surface)); }
html[data-user-theme="dark"] .hl { --hl-link: color-mix(in srgb, var(--color-primary) 32%, var(--color-on-dark)); }
@media (prefers-color-scheme: dark) { html[data-user-theme="system"] .hl { --hl-link: color-mix(in srgb, var(--color-primary) 32%, var(--color-on-dark)); } }
.hl .lv-card { padding: 20px 22px; }

/* ── Dải đầu ──────────────────────────────────────────────────────────────────────────────────────── */
.hl-band { --lv-band-pb: 104px; }
.hl-band--lesson { --lv-band-pb: 96px; }
.hl-hero { display: flex; align-items: center; justify-content: space-between; gap: 28px; flex-wrap: wrap; }
.hl-hero__l { flex: 1 1 460px; min-width: 0; }
.hl-title { font-size: clamp(26px, 3vw, 38px); font-weight: 700; letter-spacing: -.025em; line-height: 1.15; }
.hl-band--lesson .hl-title { font-size: clamp(24px, 2.6vw, 34px); max-width: 26ch; }
.hl-title span { color: var(--color-brand-gold); }
.hl-title small { display: block; margin-top: 6px; font-size: .5em; font-weight: 500; letter-spacing: 0; opacity: .8; }
.hl-crumb { margin: 0 0 8px !important; font-size: 13px; color: var(--lv-on-2); }
.hl-crumb a { color: var(--lv-on); text-decoration: underline; text-underline-offset: 3px; }
.hl-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.hl-chips .lv-chip-d { gap: 6px; }
.hl-chip--ok { color: var(--lv-on); background: color-mix(in srgb, var(--hl-ok) 45%, transparent); }
.hl-progress { flex: none; width: min(300px, 100%); display: flex; flex-direction: column; gap: 8px; padding: 18px 20px; color: var(--lv-on); }
.hl-progress small { font-size: 12px; font-weight: 600; color: var(--color-brand-gold); }
.hl-progress b { font-size: 34px; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.hl-progress b span { font-size: 15px; font-weight: 500; opacity: .75; margin-left: 4px; }
.hl-progress__p { margin: 0 !important; font-size: 13.5px; line-height: 1.55; color: var(--lv-on-2); }
.hl-progress__bar { display: block; height: 6px; border-radius: 999px; background: color-mix(in srgb, var(--color-on-dark) 16%, transparent); }
.hl-progress__bar i { display: block; height: 100%; border-radius: inherit; background: var(--color-brand-gold); }
.hl-progress .lv-btn { margin-top: 4px; }
.hl-progress__ok { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; }

/* ── Khung hai cột ────────────────────────────────────────────────────────────────────────────────── */
.hl-body { position: relative; z-index: 1; margin-top: -76px; }
/* Trang chính: mở đầu bằng chip cấp và tiêu đề cấp (chữ trên nền sáng) ⇒ không chồng mép dải. */
.hl-band--index { --lv-band-pb: 44px; }
.hl .hl-body--index { margin-top: 0; padding-top: 24px; }
.hl-cols { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.hl-cols--lesson { grid-template-columns: minmax(0, 1fr) 300px; }
.hl-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.hl-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.hl-side--lesson { position: sticky; top: calc(var(--nav-h, 64px) + 14px); max-height: calc(100vh - var(--nav-h, 64px) - 28px); overflow-y: auto;
    scrollbar-width: thin; border-radius: var(--lv-r, 16px); }
.hl-level { margin: 8px 0 -4px !important; font-size: 15px; font-weight: 700; color: var(--lv-ink); }

/* ── Một bộ: đầu bộ + danh sách bài ───────────────────────────────────────────────────────────────── */
.hl-set__h { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; padding-bottom: 16px;
    margin-bottom: 14px; border-bottom: 1px solid var(--lv-hair); }
.hl-set__t { display: flex; gap: 14px; flex: 1 1 380px; min-width: 0; }
.hl-set__lv { flex: none; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 13px; font-size: 15px; font-weight: 700;
    color: var(--color-on-dark); background: linear-gradient(140deg, var(--color-primary), color-mix(in srgb, var(--color-primary) 60%, var(--lv-ink))); }
.hl-set h2 { margin: 0 0 4px !important; font-size: 19px; font-weight: 700; letter-spacing: -.01em; color: var(--lv-ink); }
.hl-set h2 a { color: inherit; text-decoration: none; }
.hl-set h2 a:hover { color: var(--hl-link); }
.hl-set__t p { margin: 0 !important; font-size: 14px; line-height: 1.55; color: var(--lv-muted); max-width: 62ch; }
.hl-set__m { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; padding-top: 4px; font-size: 13px; color: var(--lv-muted); }
.hl-set__bar { display: block; width: 150px; height: 6px; border-radius: 999px; background: var(--lv-sunken); }
.hl-set__bar i { display: block; height: 100%; border-radius: inherit; background: var(--hl-ok); }

.hl-list { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.hl-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; height: 100%; padding: 11px 12px;
    border: 1px solid var(--lv-hair); border-radius: 13px; background: var(--lv-surface); color: var(--lv-text); text-decoration: none;
    transition: border-color .15s, background .15s; }
.hl-row:hover { border-color: color-mix(in srgb, var(--color-primary) 35%, var(--lv-hair)); background: var(--lv-wash); }
.hl-row__no { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; font-size: 13.5px; font-weight: 700;
    background: var(--lv-sunken); color: var(--lv-ink); }
.hl-row.is-done .hl-row__no { background: var(--hl-ok); color: var(--color-on-dark); }
.hl-row__m { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hl-row__m b { font-size: 14.5px; font-weight: 600; line-height: 1.35; color: var(--lv-ink); }
.hl-row__m small { font-size: 12.5px; color: var(--lv-muted); }
.hl-row__lock { color: var(--lv-muted); display: grid; }
.hl-row__free { font-size: 12px; font-weight: 600; color: var(--hl-ok-fg); background: var(--hl-ok-soft); padding: 3px 8px; border-radius: 999px; white-space: nowrap; }

/* Trang chính: chip nhảy tới cấp + lưới thẻ bộ */
.hl-levels { display: flex; flex-wrap: wrap; gap: 8px; }
.hl-levels a { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--lv-hair); background: var(--lv-surface); font-size: 13.5px; font-weight: 600;
    color: var(--lv-ink); text-decoration: none; }
.hl-levels a:hover { border-color: color-mix(in srgb, var(--color-primary) 35%, var(--lv-hair)); color: var(--hl-link); }
.hl-lvsec { display: flex; flex-direction: column; gap: 12px; scroll-margin-top: calc(var(--nav-h, 64px) + 16px); }
.hl-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.hl .lv-card.hl-scard { display: flex; flex-direction: column; gap: 6px; height: 100%; padding: 18px 20px; text-decoration: none; color: var(--lv-text);
    transition: border-color .15s, transform .15s; }
.hl-scard:hover { border-color: color-mix(in srgb, var(--color-primary) 35%, var(--lv-hair)); transform: translateY(-1px); }
.hl-scard__top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.hl-scard__top .hl-set__lv { width: 40px; height: 40px; border-radius: 12px; font-size: 14px; }
.hl-scard__de { font-size: 13px; font-weight: 600; color: var(--lv-muted); }
.hl-scard b { font-size: 16.5px; font-weight: 700; color: var(--lv-ink); }
.hl-scard small { font-size: 13.5px; line-height: 1.55; color: var(--lv-muted); }
.hl-scard__m { margin-top: auto; padding-top: 10px; display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; color: var(--lv-muted); }
.hl-scard__m .hl-set__bar { width: 100%; }

/* Cột phải trang danh sách */
.hl-next h3 { margin: 12px 0 2px !important; font-size: 13px; font-weight: 650; color: var(--lv-muted); }
.hl-next h2 { margin: 0 0 10px !important; font-size: 16px; font-weight: 700; color: var(--lv-ink); }
.hl-next ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; }
.hl-next li + li { border-top: 1px solid var(--lv-hair); }
.hl-next a { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 10px; padding: 11px 2px; text-decoration: none; color: var(--lv-text); }
.hl-next a b { font-size: 14px; font-weight: 600; color: var(--lv-ink); }
.hl-next a small { grid-column: 1; font-size: 12.5px; line-height: 1.45; color: var(--lv-muted); }
.hl-next a svg { grid-row: 1 / span 2; grid-column: 2; color: var(--lv-muted); }
.hl-next a:hover b { color: var(--hl-link); }

/* ── Thân bài ─────────────────────────────────────────────────────────────────────────────────────── */
.hl .lv-card.hl-article { padding: 28px 34px 30px; font-size: 15.5px; line-height: 1.75; color: var(--lv-text); }
.hl .hl-article > :first-child { margin-top: 0 !important; padding-top: 0; }
.hl-article p { margin: 0 0 14px !important; }
.hl-article .md-h2 { margin: 30px 0 12px !important; padding-top: 4px; font-size: 21px; font-weight: 700; letter-spacing: -.015em; line-height: 1.3;
    color: var(--lv-ink); scroll-margin-top: calc(var(--nav-h, 64px) + 16px); }
.hl-article .md-h3 { margin: 22px 0 8px !important; font-size: 17px; font-weight: 700; color: var(--lv-ink); }
.hl-article .md-h4 { margin: 18px 0 6px !important; font-size: 15.5px; font-weight: 700; color: var(--lv-ink); }
.hl-article ul, .hl-article ol { margin: 0 0 14px; padding-left: 22px; }
.hl-article li { margin: 4px 0; }
.hl-article li > ul, .hl-article li > ol { margin: 4px 0 0; }
.hl-article strong { color: var(--lv-ink); font-weight: 650; }
.hl-article del { color: var(--color-gender-die-fg); text-decoration-thickness: 1.5px; }
.hl-article a:not(.lv-btn) { color: var(--hl-link); text-decoration: underline; text-underline-offset: 3px; }
.hl-article code { font-family: inherit; font-size: .95em; padding: 1px 6px; border-radius: 6px; background: var(--lv-sunken); color: var(--lv-ink); }
.hl-article .md-hr { border: 0; border-top: 1px solid var(--lv-hair); margin: 24px 0; }
.hl-article .md-table-wrap { margin: 4px 0 18px; overflow-x: auto; border: 1px solid var(--lv-hair); border-radius: 12px; }
.hl-article .md-table { width: 100%; border-collapse: collapse; font-size: 14.5px; line-height: 1.55; }
.hl-article .md-table th { text-align: left; font-weight: 650; color: var(--lv-ink); background: var(--lv-sunken); }
.hl-article .md-table th, .hl-article .md-table td { padding: 10px 14px; border-bottom: 1px solid var(--lv-hair); vertical-align: top; }
.hl-article .md-table tr:last-child td { border-bottom: 0; }
.hl-article .md-quote { margin: 0 0 16px; padding: 12px 16px; border-left: 3px solid var(--color-brand-gold); border-radius: 0 12px 12px 0;
    background: var(--hl-gold-soft); color: var(--lv-text); }

/* Khung: chữ tiếng Đức (bài mẫu), đề bài, ghi nhớ */
.hl-box { margin: 6px 0 18px; border-radius: 14px; border: 1px solid var(--lv-hair); overflow: hidden; }
.hl-box figcaption, .hl-article .hl-box__h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 !important;
    padding: 9px 16px; font-size: 13px; font-weight: 650; color: var(--lv-ink); border-bottom: 1px solid var(--lv-hair); }
.hl-box__n { font-weight: 500; color: var(--lv-muted); font-variant-numeric: tabular-nums; }
.hl-box--de { background: var(--lv-surface); }
.hl-box--de figcaption { background: var(--lv-sunken); }
.hl-de { padding: 14px 18px 4px; font-size: 15.5px; line-height: 1.7; color: var(--lv-ink); hyphens: manual; -webkit-hyphens: manual; }
.hl-de p { margin: 0 0 12px !important; }
.hl-de strong { color: var(--hl-link); }
.hl-box--task { background: color-mix(in srgb, var(--color-primary) 5%, var(--lv-surface)); border-color: color-mix(in srgb, var(--color-primary) 22%, var(--lv-hair)); }
.hl-box--task .hl-box__h { border-color: color-mix(in srgb, var(--color-primary) 18%, var(--lv-hair)); }
.hl-box--note { background: var(--hl-gold-soft); border-color: color-mix(in srgb, var(--color-brand-gold) 38%, var(--lv-hair)); }
.hl-box--note .hl-box__h { border-color: color-mix(in srgb, var(--color-brand-gold) 30%, var(--lv-hair)); }
.hl-box__b { padding: 12px 16px 2px; }
.hl-box__b p, .hl-box__b ul, .hl-box__b ol { margin-bottom: 10px !important; }
/* Bài nghe (:::hoertext): đầu khung có nút Nghe / Hiện lời, lời bài ẩn tới khi bấm, dòng đang đọc được tô */
.hl-box--hoer { background: color-mix(in srgb, var(--color-primary) 4%, var(--lv-surface)); border-color: color-mix(in srgb, var(--color-primary) 22%, var(--lv-hair)); }
.hl-article .hl-box--hoer .hl-box__h { flex-wrap: wrap; padding: 10px 14px 10px 16px; border-bottom: 0; }
.hl-hoer__a { display: flex; flex-wrap: wrap; gap: 8px; }
.hl-hoer__a .lv-btn { min-width: 92px; min-height: 40px; justify-content: center; }
.hl-article .hl-hoer__lines { margin: 0; padding: 12px 16px 12px 38px; border-top: 1px solid color-mix(in srgb, var(--color-primary) 18%, var(--lv-hair));
    font-size: 15px; line-height: 1.65; color: var(--lv-ink); hyphens: manual; -webkit-hyphens: manual; }
.hl-article .hl-hoer__lines li { margin: 2px 0; padding: 2px 8px; border-radius: 8px; transition: background .15s; }
.hl-hoer__lines li b { margin-right: 4px; font-weight: 650; color: var(--hl-link); }
.hl-hoer__lines li.is-cur { background: var(--lv-wash); }
.hl-ans { margin: 4px 0 18px; border: 1px dashed color-mix(in srgb, var(--color-primary) 35%, var(--lv-hair)); border-radius: 12px; }
.hl-ans summary { cursor: pointer; padding: 10px 14px; font-size: 14px; font-weight: 600; color: var(--hl-link); list-style: none; }
.hl-ans summary::-webkit-details-marker { display: none; }
.hl-ans summary::before { content: '+'; display: inline-block; width: 1.1em; font-weight: 700; }
.hl-ans[open] summary::before { content: '−'; }
.hl-ans__b { padding: 0 16px 6px; border-top: 1px dashed var(--lv-hair); padding-top: 12px; }

/* Nguồn (bài nêu quy định, thời hạn) */
.hl-src { margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--lv-hair); font-size: 14px; }
.hl-article .hl-src h2 { margin: 0 0 8px !important; font-size: 15px; font-weight: 700; color: var(--lv-ink); }
.hl-src ul { margin: 0 0 8px; padding-left: 20px; }
.hl-article .hl-src p { margin: 0 !important; font-size: 13px; color: var(--lv-muted); }

/* Bài khoá */
.hl-lockToc { color: var(--lv-muted); }
.hl-lock { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 18px; padding: 26px 22px; text-align: center;
    border-radius: 16px; background: var(--hl-gold-soft); border: 1px solid color-mix(in srgb, var(--color-brand-gold) 38%, var(--lv-hair)); }
.hl-lock__ic { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 50%; background: var(--lv-surface); color: var(--lv-ink); }
.hl-lock h2 { margin: 0 !important; font-size: 18px; font-weight: 700; color: var(--lv-ink); }
.hl-lock p { margin: 0 !important; max-width: 50ch; font-size: 14.5px; line-height: 1.6; }
.hl-lock__a { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 6px; }

/* Cột phải trang bài */
.hl-toc, .hl-mini { display: flex; flex-direction: column; gap: 2px; padding: 14px 14px !important; }
.hl-toc small, .hl-mini small { margin: 0 0 6px 6px; font-size: 12px; font-weight: 650; color: var(--lv-muted); }
.hl-toc a { padding: 6px 8px; border-radius: 8px; font-size: 13.5px; line-height: 1.4; color: var(--lv-text); text-decoration: none; }
.hl-toc a:hover { background: var(--lv-sunken); color: var(--lv-ink); }
.hl-mini a { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 9px;
    font-size: 13px; line-height: 1.35; color: var(--lv-text); text-decoration: none; }
.hl-mini a:hover { background: var(--lv-sunken); }
.hl-mini a.is-cur { background: var(--lv-wash); color: var(--lv-ink); font-weight: 600; }
.hl-mini__no { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 7px; font-size: 12px; font-weight: 700; background: var(--lv-sunken); color: var(--lv-ink); }
.hl-mini__no svg { width: 13px; height: 13px; }
.hl-mini a.is-cur .hl-mini__no { background: var(--color-primary); color: var(--color-on-dark); }
.hl-mini a.is-done .hl-mini__no { background: var(--hl-ok); color: var(--color-on-dark); }
.hl-mini__lock { color: var(--lv-muted); display: grid; }
.hl-end { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 20px 18px !important; }
.hl-end__ic { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: var(--lv-sunken); color: var(--lv-muted); }
.hl-end__ic.is-done { background: var(--hl-ok-soft); color: var(--hl-ok-fg); }
.hl-end p { margin: 0 !important; font-size: 13.5px; line-height: 1.55; color: var(--lv-text); }
.hl-end .lv-btn { width: 100%; justify-content: center; }

/* Từ ghép tiếng Đức dài trong bảng (deu_hl_long_words): ngắt theo từ điển tiếng Đức thay vì đẩy bảng rộng ra. */
.hl-article .hl-long { hyphens: auto; }

/* Bài trước / Bài tiếp */
.hl-pager { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; margin-top: 22px; }
.hl .lv-card.hl-pager__a { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 14px 16px; text-decoration: none; color: var(--lv-muted); transition: border-color .15s; }
.hl-pager__a:hover { border-color: color-mix(in srgb, var(--color-primary) 35%, var(--lv-hair)); }
.hl-pager__a span { display: flex; flex-direction: column; min-width: 0; }
.hl-pager__a small { font-size: 12px; color: var(--lv-muted); }
.hl-pager__a b { font-size: 14.5px; font-weight: 600; color: var(--lv-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hl-pager__a--next { grid-column: 2; justify-content: flex-end; text-align: right; }

/* Gập cột theo bề rộng VÙNG NỘI DUNG (thanh menu trái của app học chiếm ~240px), không theo bề rộng màn hình. */
.hl-body { container-type: inline-size; }
@container (max-width: 940px) { .hl-list { grid-template-columns: minmax(0, 1fr); } }
@container (max-width: 640px) { .hl-grid { grid-template-columns: minmax(0, 1fr); } }
@container (max-width: 860px) {
  .hl-cols, .hl-cols--lesson { grid-template-columns: minmax(0, 1fr); }
  .hl-side--lesson { position: static; max-height: none; overflow: visible; }
  .hl-toc { display: none; }
}
/* Bảng từ 3 cột (md-table--stack, includes/deu/hoc_lieu.php) trên màn hẹp: mỗi hàng một thẻ, nhãn cột in nhỏ trên từng ô. */
@container (max-width: 600px) {
  .hl-article .md-table--stack thead { display: none; }
  .hl-article .md-table--stack, .hl-article .md-table--stack tbody, .hl-article .md-table--stack tr, .hl-article .md-table--stack td { display: block; width: 100%; }
  .hl-article .md-table--stack tr { padding: 10px 14px; border-bottom: 1px solid var(--lv-hair); }
  .hl-article .md-table--stack tr:last-child { border-bottom: 0; }
  .hl-article .md-table--stack td { padding: 3px 0; border: 0; }
  .hl-article .md-table--stack td:first-child { font-weight: 650; color: var(--lv-ink); }
  .hl-article .md-table--stack td[data-label]:not(:first-child)::before { content: attr(data-label); display: block; font-size: 12px; font-weight: 600; color: var(--lv-muted); }
}
@media (max-width: 720px) {
  .hl-body:not(.hl-body--index) { margin-top: -64px; }
  .hl-progress { width: 100%; }
  .hl-set__m { align-items: flex-start; }
  .hl .lv-card.hl-article { padding: 20px 18px 22px; font-size: 15px; }
  .hl-article .md-h2 { font-size: 19px; }
}
@media (max-width: 560px) {
  .hl .lv-card { padding: 16px; }
  .hl-de { padding: 12px 14px 2px; font-size: 15px; }
  .hl-pager { grid-template-columns: minmax(0, 1fr); }
  .hl-pager__a--next { grid-column: 1; }
}
