html.scroll-lock, html.scroll-lock body { overflow: hidden; overscroll-behavior: none; }
html.scroll-lock body { position: fixed; left: 0; right: 0; width: 100%; }

.lesson-cta { margin: 4px 0 12px; }
.lesson-cta .btn[disabled] { opacity: .6; cursor: default; font-size: 13px; }
.tag.lesson-tag { background: var(--ok-soft); color: var(--ok); }
.now-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.now-actions .btn { white-space: nowrap; }

dialog.lesson { width: min(820px, 100vw); max-width: 100vw; height: min(100dvh, 100vh); max-height: 100dvh; margin: auto;
  border-radius: 0; padding: 0; display: none; flex-direction: column; overflow: hidden; }
dialog.lesson[open] { display: flex; }
@media (min-width: 860px) { dialog.lesson { height: 92vh; border-radius: 18px; } }

.lesson-bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line);
  padding-top: max(10px, env(safe-area-inset-top)); }
.lesson-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lesson-body { flex: 1; overflow-y: auto; padding: 8px 22px 40px; font-size: 16px; line-height: 1.7; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain; }
.lesson-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 10px 14px;
  border-top: 1px solid var(--line); padding-bottom: max(10px, env(safe-area-inset-bottom)); }

.lesson-body h1 { font-size: 24px; line-height: 1.3; margin: 18px 0 12px; }
.lesson-body h2 { font-size: 20px; margin: 30px 0 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.lesson-body h3 { font-size: 17px; margin: 22px 0 8px; color: var(--accent); }
.lesson-body h4 { font-size: 15px; margin: 18px 0 6px; }
.lesson-body p { margin: 10px 0; }
.lesson-body ul, .lesson-body ol { padding-left: 22px; margin: 8px 0; }
.lesson-body li { margin: 4px 0; }
.lesson-body li > p { margin: 4px 0; }
.lesson-body a { word-break: break-word; }
.lesson-body hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.lesson-body code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .88em;
  background: var(--bg); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; word-break: break-word; }

.lesson-body blockquote { margin: 14px 0; padding: 4px 14px; background: var(--accent-soft); border-left: 4px solid var(--accent);
  border-radius: 0 10px 10px 0; }
.lesson-body blockquote p { margin: 6px 0; }

.lesson-body .code { margin: 12px 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #0f1320; }
.lesson-body .code-h { display: flex; justify-content: space-between; align-items: center; padding: 5px 10px;
  background: #1a2033; color: #9aa3bd; font-size: 12px; }
.lesson-body .copy { border: 1px solid #2c3550; background: transparent; color: #c9d2ec; border-radius: 6px; padding: 2px 9px;
  font: inherit; font-size: 12px; cursor: pointer; }
.lesson-body pre { margin: 0; padding: 12px 14px; overflow-x: auto; }
.lesson-body pre code { background: none; border: 0; padding: 0; color: #e3e8f7; font-size: 13px; line-height: 1.55;
  word-break: normal; white-space: pre; }

.lesson-body .tbl { overflow-x: auto; margin: 12px 0; border: 1px solid var(--line); border-radius: 10px; }
.lesson-body table { border-collapse: collapse; width: 100%; font-size: 14px; line-height: 1.5; }
.lesson-body th, .lesson-body td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.lesson-body th { background: var(--bg); font-weight: 600; white-space: nowrap; }
.lesson-body tr:last-child td { border-bottom: 0; }

.lesson-body details.qa { border: 1px solid var(--line); border-radius: 10px; margin: 8px 0; background: var(--card); }
.lesson-body details.qa summary { display: block; cursor: pointer; padding: 10px 14px; font-weight: 600; grid-template-columns: none; }
.lesson-body details.qa summary::after { content: ' — bấm để xem đáp án'; font-weight: 400; color: var(--muted); font-size: 13px; }
.lesson-body details.qa[open] summary::after { content: ''; }
.lesson-body .qa-body { padding: 0 14px 10px; border-top: 1px dashed var(--line); }

@media (max-width: 560px) {
  .lesson-body { padding: 4px 16px 32px; font-size: 15.5px; }
  .lesson-body h1 { font-size: 21px; }
  .lesson-body h2 { font-size: 18px; }
  .now { flex-wrap: wrap; }
  .now-actions { flex-direction: row; width: 100%; }
  .now-actions .btn { flex: 1; }
}
