html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e9f0f7;
  --muted: #a6b5c6;
  --line: #293b4d;
  --paper: #0c1622;
  --soft: #111f2d;
  --blue: #8bb4ff;
  --blue2: #7ea9d0;
  --shadow: 0 20px 55px rgba(0, 0, 0, .35);
}

html[data-theme="dark"] body,
html[data-theme="dark"] .section,
html[data-theme="dark"] .section.soft,
html[data-theme="dark"] .wordSection,
html[data-theme="dark"] .contact {
  background: var(--paper) !important;
  color: var(--ink) !important;
}

html[data-theme="dark"] .siteHeader {
  background: rgba(12, 22, 34, .96) !important;
  border-color: var(--line) !important;
}
html[data-theme="dark"] .siteHeader .navlinks,
html[data-theme="dark"] .siteHeader .navlinks a,
html[data-theme="dark"] .sectionTitle p,
html[data-theme="dark"] .contact p,
html[data-theme="dark"] .langCard p,
html[data-theme="dark"] .lessonCard p,
html[data-theme="dark"] .glossMeta,
html[data-theme="dark"] .glossary td,
html[data-theme="dark"] .pager,
html[data-theme="dark"] .contact label,
html[data-theme="dark"] .tiny {
  color: #b7c5d4 !important;
}

html[data-theme="dark"] .brandLogo .wordmarkMain,
html[data-theme="dark"] .brandLogo .wordmarkSub {
  color: #f0f4f8 !important;
}

html[data-theme="dark"] .langCard,
html[data-theme="dark"] .lessonCard,
html[data-theme="dark"] .glossary,
html[data-theme="dark"] .wordListPanel,
html[data-theme="dark"] .contact form,
html[data-theme="dark"] .contactLink,
html[data-theme="dark"] .quizTab,
html[data-theme="dark"] .lessonDialog,
html[data-theme="dark"] .lessonBlock,
html[data-theme="dark"] .wordListHead,
html[data-theme="dark"] .wordList,
html[data-theme="dark"] .glossary th,
html[data-theme="dark"] .pager,
html[data-theme="dark"] .toolRow {
  background: #142334 !important;
  color: var(--ink) !important;
  border-color: var(--line) !important;
}

html[data-theme="dark"] .tool,
html[data-theme="dark"] .contact input,
html[data-theme="dark"] .contact select,
html[data-theme="dark"] .contact textarea,
html[data-theme="dark"] .lessonDialogHead .select {
  background: #0c1723 !important;
  color: var(--ink) !important;
  border-color: #35495e !important;
}

html[data-theme="dark"] .wordListHead span,
html[data-theme="dark"] .wordRow span,
html[data-theme="dark"] .wordRow span:last-child,
html[data-theme="dark"] .lessonBlock p,
html[data-theme="dark"] .lessonBlock li,
html[data-theme="dark"] .dialogueLine,
html[data-theme="dark"] .glossary th {
  color: #b9c8d8 !important;
}

html[data-theme="dark"] .dialogueLine {
  background: #0d1a28 !important;
  border-color: var(--line) !important;
}
html[data-theme="dark"] .lessonDialogueBlock {
  background: #101e2c !important;
}
html[data-theme="dark"] .practiceBlock {
  background: #2b2518 !important;
  border-color: #554628 !important;
}
html[data-theme="dark"] .practiceBlock h3 {
  color: #ffd477 !important;
}
html[data-theme="dark"] .lessonDialog .lessonBlock h3,
html[data-theme="dark"] .lessonDialog .dialogueLine strong {
  color: #fff !important;
}
html[data-theme="dark"] .btn.ghost,
html[data-theme="dark"] .pagerBtns button {
  background: #17283a !important;
  color: var(--ink) !important;
  border-color: #35495e !important;
}
html[data-theme="dark"] .tag {
  background: #1d3552 !important;
  color: #b4d0ff !important;
}

.themeToggle {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  border: 1px solid #dce4ed;
  border-radius: 12px;
  background: #fff;
  color: #10243f;
  cursor: pointer;
}
.themeToggle:hover { background: #f3f6fa; }
.themeToggle svg { width: 19px; height: 19px; }
.themeToggle .sunIcon { display: none; }
html[data-theme="dark"] .themeToggle {
  background: #17283a;
  color: #f7d98b;
  border-color: #35495e;
}
html[data-theme="dark"] .themeToggle:hover { background: #20364c; }
html[data-theme="dark"] .themeToggle .moonIcon { display: none; }
html[data-theme="dark"] .themeToggle .sunIcon { display: block; }
.srOnly {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html {
  scrollbar-width: thin;
  scrollbar-color: #aab7c5 #f1f4f7;
}
html[data-theme="dark"] {
  scrollbar-color: #53677b #111f2d;
}
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: #f1f4f7;
}
::-webkit-scrollbar-thumb {
  min-height: 36px;
  background: #aab7c5;
  border: 3px solid #f1f4f7;
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #7f91a4;
}
html[data-theme="dark"] ::-webkit-scrollbar-track {
  background: #111f2d;
}
html[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: #53677b;
  border-color: #111f2d;
}
html[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
  background: #748da6;
}

@media (prefers-reduced-motion: no-preference) {
  body, body * { transition: background-color .2s ease, color .2s ease, border-color .2s ease; }
}

/* Branded scrollbar finish */
html {
  scrollbar-color: #b9964d transparent;
}
html[data-theme="dark"] {
  scrollbar-color: #c9a653 #101a25;
}
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #dfc780 0%, #b38d3c 52%, #d7bd76 100%);
  border: 2px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #f0dda5 0%, #c6a04d 52%, #e8d18d 100%);
  background-clip: padding-box;
}
html[data-theme="dark"] ::-webkit-scrollbar-track {
  background: #101a25;
}
html[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #eddaa0 0%, #c39b46 52%, #e2c779 100%);
  border-color: #101a25;
}
.wordList::-webkit-scrollbar {
  width: 8px;
}
.wordList::-webkit-scrollbar-track {
  background: #f7f8fa;
}
.wordList::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #dfc780, #b38d3c, #d7bd76);
  border: 2px solid #f7f8fa;
  border-radius: 999px;
}
html[data-theme="dark"] .wordList::-webkit-scrollbar-track {
  background: #101a25;
}
html[data-theme="dark"] .wordList::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #eddaa0, #c39b46, #e2c779);
  border-color: #101a25;
}

.pdfLessonsGrid {
  display: grid;
  gap: 18px;
  margin-top: 28px;
  max-width: 920px;
}
.pdfLessonCard {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid #e5ebf1;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(16, 36, 63, .07);
}
.pdfCover {
  position: relative;
  min-height: 245px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 17px;
  overflow: hidden;
  background: radial-gradient(ellipse at 80% 15%, rgba(215, 184, 111, .24), transparent 40%), linear-gradient(145deg, #10243f, #071321);
  color: #e2c579;
}
.pdfCover::after {
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(226, 197, 121, .35);
  border-radius: 13px;
  content: "";
  pointer-events: none;
}
.pdfCoverLabel {
  color: #efd996;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .2em;
}
.pdfCover svg {
  width: 60px;
  height: 72px;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, .3));
}
.pdfCoverPreview {
  display: block;
  height: 245px;
  min-height: 245px;
  padding: 0;
  background: #071321;
}
.pdfCoverPreview::before {
  position: absolute;
  z-index: 2;
  top: 0;
  right: 0;
  bottom: 0;
  width: 16px;
  background: #071321;
  content: "";
  pointer-events: none;
}
.pdfCoverPreview iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
  pointer-events: none;
}
.pdfCoverDesigned {
  min-height: 245px;
  padding: 24px 18px 21px;
  justify-content: flex-start;
  gap: 10px;
  text-align: center;
}
.pdfCoverDesigned img {
  width: 64px;
  height: 78px;
  border: 1px solid rgba(226, 197, 121, .34);
  border-radius: 7px;
  object-fit: contain;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .3);
}
.pdfDesignedTitle {
  color: #f4f0e7;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 15px;
  line-height: 1.15;
}
.pdfDesignedSub {
  color: #e2c579;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .18em;
}
.pdfBadge {
  position: absolute;
  right: 20px;
  bottom: 20px;
  padding: 5px 9px;
  border: 1px solid rgba(226, 197, 121, .45);
  border-radius: 7px;
  color: #f0d98e;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .12em;
}
.pdfLessonInfo {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 28px;
}
.pdfLessonInfo h3 {
  margin: 8px 0 6px;
  color: #10243f;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 28px;
  line-height: 1.15;
}
.pdfLessonInfo p {
  max-width: 650px;
  margin: 0;
  color: #66768a;
  font-size: 13px;
}
.pdfMeta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 17px;
  color: #7b8999;
  font-size: 10px;
  font-weight: 700;
}
.pdfMeta span + span::before {
  margin-right: 18px;
  color: #c4a253;
  content: "•";
}
.pdfActions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 22px;
}
html[data-theme="dark"] .pdfLessonCard {
  border-color: var(--line);
  background: #142334;
}
html[data-theme="dark"] .pdfLessonInfo h3 {
  color: var(--ink);
}
html[data-theme="dark"] .pdfLessonInfo p,
html[data-theme="dark"] .pdfMeta {
  color: #b7c5d4;
}
.pdfLessonCardCompact {
  grid-template-columns: 150px minmax(0, 1fr);
  height: 230px;
  min-height: 230px;
  align-items: stretch;
}
.pdfLessonCardCompact .pdfCoverDesigned {
  height: 230px;
  min-height: 230px;
  box-sizing: border-box;
  padding: 15px 12px;
  gap: 7px;
}
.pdfLessonCardCompact .pdfCoverPreview {
  height: 230px;
  min-height: 230px;
}
.pdfLessonCardCompact .pdfCoverDesigned img {
  width: 46px;
  height: 56px;
}
.pdfLessonCardCompact .pdfLessonInfo {
  padding: 19px 24px;
}
.pdfLessonCardCompact .pdfLessonInfo h3 {
  margin: 5px 0;
  font-size: 24px;
}
.pdfLessonCardCompact .pdfMeta {
  margin-top: 9px;
}
.pdfLessonCardCompact .pdfActions {
  margin-top: 13px;
}
.pdfReaderModal {
  position: fixed;
  z-index: 500;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(5, 15, 27, .76);
  backdrop-filter: blur(6px);
}
.pdfReaderModal.open { display: flex; }
.pdfReaderDialog {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1120px, 100%);
  height: min(900px, 92vh);
  overflow: hidden;
  border: 1px solid #dfe6ee;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 28px 90px rgba(0, 0, 0, .35);
}
.pdfReaderHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 62px;
  padding: 10px 16px 10px 22px;
  border-bottom: 1px solid #e5ebf1;
  color: #10243f;
}
.pdfReaderTitle { margin: 0; font: 700 17px/1.2 "Playfair Display", Georgia, serif; }
.pdfReaderTools { display: flex; align-items: center; gap: 9px; }
.pdfReaderExternal { color: #155dff; font-size: 12px; font-weight: 800; text-decoration: none; }
.pdfReaderClose {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid #e1e7ee;
  border-radius: 50%;
  background: #f7f9fc;
  color: #10243f;
  font-size: 23px;
  cursor: pointer;
}
.pdfReaderFrame { width: 100%; height: 100%; border: 0; background: #eef2f7; }
html[data-theme="dark"] .pdfReaderDialog { border-color: #35465a; background: #142334; }
html[data-theme="dark"] .pdfReaderHeader { border-color: #35465a; color: #f1f5f9; }
html[data-theme="dark"] .pdfReaderClose { border-color: #35465a; background: #1d3044; color: #f1f5f9; }
@media (max-width: 620px) {
  .pdfLessonCard { grid-template-columns: 1fr; }
  .pdfCover { min-height: 190px; }
  .pdfCoverPreview { height: 190px; min-height: 190px; }
  .pdfCoverDesigned { min-height: 190px; padding: 18px 14px; gap: 7px; }
  .pdfCoverDesigned img { width: 48px; height: 58px; }
  .pdfDesignedTitle { font-size: 13px; }
  .pdfLessonInfo { padding: 21px; }
  .pdfLessonInfo h3 { font-size: 24px; }
  .pdfActions .btn { flex: 1 1 100%; }
  .pdfLessonCardCompact { height: auto; min-height: 0; grid-template-columns: 1fr; }
  .pdfLessonCardCompact .pdfCoverDesigned { height: 200px; min-height: 200px; }
  .pdfLessonCardCompact .pdfLessonInfo { padding: 19px 21px; }
  .pdfReaderModal { padding: 0; }
  .pdfReaderDialog { width: 100%; height: 100%; height: 100dvh; border-radius: 0; }
  .pdfReaderHeader { min-height: 58px; padding: 9px 12px 9px 16px; }
  .pdfReaderTitle { font-size: 15px; }
  .pdfReaderExternal { font-size: 11px; }
}
