/*
 * SININBE EDU 3.1 — universal local reader.
 * Loaded after the legacy reader stylesheet so these rules are the final
 * responsive layout authority for both library and message attachments.
 */

#m-lesson-viewer {
  align-items: center !important;
  justify-content: center !important;
  padding:
    max(8px, env(safe-area-inset-top))
    max(8px, env(safe-area-inset-right))
    max(8px, env(safe-area-inset-bottom))
    max(8px, env(safe-area-inset-left)) !important;
  overflow: hidden !important;
  overscroll-behavior: contain;
}

#m-lesson-viewer .edu-lsv-box {
  width: min(1440px, 100%) !important;
  height: min(980px, 100%) !important;
  max-width: 1440px !important;
  max-height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  display: grid !important;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: 0 !important;
  border: 1px solid rgba(148, 163, 184, .22) !important;
  border-radius: 20px !important;
  overflow: hidden !important;
  background: #07111f !important;
  box-shadow: 0 28px 90px rgba(0, 0, 0, .52) !important;
}

#m-lesson-viewer.is-expanded {
  padding: 0 !important;
}

#m-lesson-viewer.is-expanded .edu-lsv-box {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  border: 0 !important;
  border-radius: 0 !important;
}

#m-lesson-viewer .edu-lsv-head {
  min-width: 0;
  min-height: 62px;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 9px 12px !important;
  background: rgba(5, 14, 27, .98) !important;
}

#m-lesson-viewer .edu-lsv-title-wrap,
#m-lesson-viewer .edu-lsv-title-wrap > div:last-child {
  min-width: 0;
}

#m-lesson-viewer .edu-lsv-title-wrap strong {
  max-width: 100%;
  font-size: clamp(.72rem, 1.4vw, .86rem) !important;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

#m-lesson-viewer .edu-lsv-actions {
  display: flex !important;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

#m-lesson-viewer .edu-lsv-actions button,
#m-lesson-viewer .edu-lsv-actions a {
  width: 38px !important;
  height: 38px !important;
  min-width: 38px;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  padding: 0 !important;
  border-radius: 11px !important;
}

#m-lesson-viewer .edu-lsv-stage {
  width: 100%;
  min-width: 0;
  min-height: 0;
  overflow: auto !important;
  padding: clamp(8px, 2.2vw, 24px) !important;
  align-items: flex-start !important;
  background:
    radial-gradient(circle at 15% 0, rgba(45, 212, 191, .08), transparent 32%),
    #0b1320 !important;
  scrollbar-gutter: stable;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

#m-lesson-viewer .edu-lsv-stage,
#m-lesson-viewer .edu-lsv-stage *:not(.fa):not(.fas):not(.far):not(.fab) {
  font-family: "Space Grotesk", "Tajawal" !important;
}

#m-lesson-viewer .edu-lsv-stage [dir="rtl"],
#m-lesson-viewer .edu-lsv-stage [dir="auto"]:dir(rtl) {
  direction: rtl;
  text-align: start;
  unicode-bidi: plaintext;
  font-family: "Tajawal", "Space Grotesk" !important;
}

#m-lesson-viewer .edu-lsv-stage [dir="ltr"],
#m-lesson-viewer .edu-lsv-stage [dir="auto"]:dir(ltr) {
  direction: ltr;
  text-align: start;
  unicode-bidi: plaintext;
  font-family: "Space Grotesk", "Tajawal" !important;
}

#m-lesson-viewer .edu-lsv-code-view,
#m-lesson-viewer .edu-lsv-code-view *,
#m-lesson-viewer pre,
#m-lesson-viewer code {
  direction: ltr !important;
  text-align: left !important;
  unicode-bidi: isolate !important;
  font-family: "Space Grotesk", "Tajawal" !important;
}

#m-lesson-viewer .edu-lsv-word-reader {
  width: min(960px, 100%) !important;
  min-width: 0;
  margin: 0 auto;
}

#m-lesson-viewer .edu-lsv-word-reader .edu-lsv-doc,
#m-lesson-viewer .edu-lsv-text {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 100% !important;
  margin: 0 !important;
  padding: clamp(18px, 5vw, 64px) !important;
  border-radius: 12px !important;
  overflow-wrap: anywhere;
  word-break: normal;
  line-height: 1.85 !important;
  user-select: text !important;
  -webkit-user-select: text !important;
}

#m-lesson-viewer .edu-lsv-doc img,
#m-lesson-viewer .edu-lsv-doc svg,
#m-lesson-viewer .edu-lsv-doc canvas,
#m-lesson-viewer .edu-lsv-doc video {
  max-width: 100% !important;
  height: auto !important;
}

#m-lesson-viewer .edu-lsv-sheet,
#m-lesson-viewer #edu-lsv-sheet-table,
#m-lesson-viewer .edu-lsv-sheet-grid {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
}

#m-lesson-viewer .edu-lsv-sheet {
  padding: 0 !important;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden !important;
  border: 1px solid #dbe2ea;
  border-radius: 12px !important;
}

#m-lesson-viewer .edu-lsv-sheet-tools,
#m-lesson-viewer .edu-lsv-sheet-tabs {
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap !important;
  scrollbar-width: thin;
}

#m-lesson-viewer #edu-lsv-sheet-table {
  min-height: 0;
  overflow: auto !important;
  -webkit-overflow-scrolling: touch;
}

#m-lesson-viewer .edu-lsv-sheet table {
  width: max-content !important;
  min-width: 100% !important;
  border-spacing: 0;
  table-layout: auto;
}

#m-lesson-viewer .edu-lsv-sheet th,
#m-lesson-viewer .edu-lsv-sheet td {
  max-width: min(420px, 72vw);
  padding: calc(7px * var(--sheet-zoom, 1)) calc(9px * var(--sheet-zoom, 1)) !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: pre-wrap !important;
  overflow-wrap: anywhere;
  vertical-align: top;
}

#m-lesson-viewer .edu-lsv-sheet thead th {
  position: sticky;
  top: 0;
  z-index: 3;
}

#m-lesson-viewer .edu-lsv-sheet tbody th {
  position: sticky;
  inset-inline-start: 0;
  z-index: 2;
}

#m-lesson-viewer .edu-lsv-pdf-shell,
#m-lesson-viewer .edu-lsv-pdf,
#m-lesson-viewer .edu-lsv-pdf-pages {
  width: 100% !important;
  min-width: 0;
}

#m-lesson-viewer .edu-lsv-pdf-tools,
#m-lesson-viewer .edu-lsv-format-tools {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

#m-lesson-viewer .edu-lsv-pdf-tools::-webkit-scrollbar,
#m-lesson-viewer .edu-lsv-format-tools::-webkit-scrollbar {
  display: none;
}

#m-lesson-viewer .edu-lsv-slide-wrap {
  width: min(1180px, 100%) !important;
  min-width: 0;
  margin: auto;
}

#m-lesson-viewer .edu-lsv-slide {
  width: 100%;
  max-width: 100%;
  border-radius: 10px;
}

#m-lesson-viewer .edu-lsv-slide-el {
  overflow: hidden;
  overflow-wrap: anywhere;
  unicode-bidi: plaintext;
}

#m-lesson-viewer .edu-lsv-office-local-fallback {
  width: min(560px, 100%);
  min-height: min(420px, 70dvh);
  margin: auto;
  padding: clamp(22px, 6vw, 52px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 13px;
  text-align: center;
  border: 1px solid rgba(148, 163, 184, .22);
  border-radius: 20px;
  background: rgba(8, 20, 37, .9);
  color: #dce8f4;
}

#m-lesson-viewer .edu-lsv-office-local-fallback > i {
  font-size: clamp(2.4rem, 8vw, 4.5rem);
  color: #2dd4bf;
}

#m-lesson-viewer .edu-lsv-office-local-fallback strong,
#m-lesson-viewer .edu-lsv-office-local-fallback p {
  max-width: 100%;
  overflow-wrap: anywhere;
}

#m-lesson-viewer .edu-lsv-office-local-fallback p {
  margin: 0;
  color: #8fa4b8;
  line-height: 1.7;
}

#m-lesson-viewer .edu-lsv-office-local-fallback a {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid rgba(45, 212, 191, .36);
  border-radius: 12px;
  background: rgba(45, 212, 191, .12);
  color: #5eead4;
  font-weight: 850;
  text-decoration: none;
}

#m-lesson-viewer .edu-lsv-foot {
  min-height: 34px;
  padding:
    6px max(10px, env(safe-area-inset-right))
    max(6px, env(safe-area-inset-bottom))
    max(10px, env(safe-area-inset-left)) !important;
  text-align: center;
}

@media (max-width: 720px) {
  #m-lesson-viewer {
    padding: 0 !important;
  }

  #m-lesson-viewer .edu-lsv-box {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    border: 0 !important;
    border-radius: 0 !important;
  }

  #m-lesson-viewer .edu-lsv-head {
    min-height: calc(54px + env(safe-area-inset-top));
    padding:
      max(6px, env(safe-area-inset-top))
      max(7px, env(safe-area-inset-right))
      6px
      max(7px, env(safe-area-inset-left)) !important;
    gap: 7px;
  }

  #m-lesson-viewer .edu-lsv-type {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  #m-lesson-viewer .edu-lsv-actions {
    gap: 4px;
  }

  #m-lesson-viewer .edu-lsv-actions button,
  #m-lesson-viewer .edu-lsv-actions a {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px;
    border-radius: 10px !important;
  }

  #m-lesson-viewer .edu-lsv-stage {
    padding: 7px !important;
    scrollbar-gutter: auto;
  }

  #m-lesson-viewer .edu-lsv-word-reader .edu-lsv-doc,
  #m-lesson-viewer .edu-lsv-text {
    padding: 18px 15px !important;
    border-radius: 8px !important;
    font-size: 14px !important;
    line-height: 1.78 !important;
  }

  #m-lesson-viewer .edu-lsv-sheet-tools {
    padding-inline: 6px !important;
  }

  #m-lesson-viewer .edu-lsv-sheet-search {
    min-width: 170px;
  }

  #m-lesson-viewer .edu-lsv-slide {
    border-radius: 5px;
  }

  #m-lesson-viewer .edu-lsv-slide-el {
    font-size: clamp(6px, 2.2vw, 12px) !important;
    line-height: 1.08 !important;
  }

  #m-lesson-viewer .edu-lsv-foot {
    font-size: .52rem;
  }
}

@media (max-width: 390px) {
  #m-lesson-viewer .edu-lsv-title-wrap span,
  #m-lesson-viewer .edu-lsv-foot span {
    display: none;
  }

  #m-lesson-viewer .edu-lsv-actions button,
  #m-lesson-viewer .edu-lsv-actions a {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  #m-lesson-viewer {
    padding: 0 !important;
  }

  #m-lesson-viewer .edu-lsv-box {
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    border: 0 !important;
    border-radius: 0 !important;
  }

  #m-lesson-viewer .edu-lsv-head {
    min-height: 46px;
    padding-block: 4px !important;
  }

  #m-lesson-viewer .edu-lsv-foot {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  #m-lesson-viewer *,
  #m-lesson-viewer *::before,
  #m-lesson-viewer *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* 4.0.39.1 — the attachment reader must not erase context on phones or
   short landscape screens; its bars wrap/scroll and remain fully reachable. */
@media (max-width: 700px), (max-height: 520px) {
  #m-lesson-viewer .edu-lsv-head{
    flex-wrap:wrap!important;
    height:auto!important;
    max-height:42dvh!important;
    overflow:auto!important;
  }
  #m-lesson-viewer .edu-lsv-title-wrap,
  #m-lesson-viewer .edu-lsv-actions{min-width:0!important;max-width:100%!important}
  #m-lesson-viewer .edu-lsv-actions{overflow-x:auto!important;overscroll-behavior-inline:contain!important}
  #m-lesson-viewer .edu-lsv-title-wrap span,
  #m-lesson-viewer .edu-lsv-foot span{display:inline!important;white-space:normal!important}
  #m-lesson-viewer .edu-lsv-foot{
    display:flex!important;
    flex-wrap:wrap!important;
    max-height:26dvh!important;
    overflow:auto!important;
    padding:5px 8px max(5px,env(safe-area-inset-bottom))!important;
  }
}

/* v3.5.4 — PowerPoint fidelity and cross-device rendering. */
#m-lesson-viewer .edu-lsv-office-web {
  position:relative;
  width:100%;
  height:100%;
  min-height:0;
  display:flex;
  align-items:stretch;
  justify-content:stretch;
  background:#111827;
  overflow:hidden;
  border-radius:10px;
}
#m-lesson-viewer .edu-lsv-office-web-frame {
  display:block;
  width:100%;
  height:100%;
  min-height:520px;
  border:0;
  background:#fff;
}
#m-lesson-viewer .edu-lsv-office-web-loading {
  position:absolute;
  inset:0;
  z-index:3;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:9px;
  color:#cbd5e1;
  background:#111827;
  font-weight:800;
}
#m-lesson-viewer .edu-lsv-office-web-loading.is-slow { opacity:.94; }
#m-lesson-viewer .edu-lsv-office-local-button {
  position:absolute;
  inset-inline-end:12px;
  inset-block-end:12px;
  z-index:4;
  display:none;
  align-items:center;
  gap:7px;
  min-height:38px;
  padding:8px 12px;
  border:1px solid rgba(255,255,255,.22);
  border-radius:11px;
  background:rgba(3,7,18,.86);
  color:#fff;
  font:800 .68rem/1 Tajawal,Arial,sans-serif;
  cursor:pointer;
  box-shadow:0 8px 24px rgba(0,0,0,.28);
  backdrop-filter:blur(12px);
}
#m-lesson-viewer .edu-lsv-office-local-button.is-visible { display:inline-flex; }
#m-lesson-viewer .edu-lsv-office-local-button:hover,
#m-lesson-viewer .edu-lsv-office-local-button:focus-visible { border-color:rgba(45,212,191,.65);color:#5eead4;outline:none; }
#m-lesson-viewer .edu-lsv-slide { container-type:inline-size; }
@supports (font-size: 1cqw) {
  #m-lesson-viewer .edu-lsv-slide-el { font-size:clamp(5px,calc(var(--edu-ppt-font,24) * .078125cqw),72px)!important; }
}
@media(max-width:700px){
  #m-lesson-viewer .edu-lsv-office-web { border-radius:0; }
  #m-lesson-viewer .edu-lsv-office-web-frame { min-height:100%; }
  #m-lesson-viewer .edu-lsv-office-local-button { inset-inline-end:8px;inset-block-end:8px;min-height:42px;max-width:calc(100% - 16px); }
}


/* v4.0.39.19 — space-efficient universal reader and real fullscreen. */
#m-lesson-viewer{
  padding:3px!important;
  align-items:stretch!important;
  justify-content:stretch!important;
}
#m-lesson-viewer .edu-lsv-box{
  position:relative!important;
  width:calc(100vw - 6px)!important;
  height:calc(100dvh - 6px)!important;
  max-width:none!important;
  max-height:none!important;
  grid-template-rows:auto minmax(0,1fr)!important;
  border-radius:14px!important;
}
@supports(height:100svh){#m-lesson-viewer .edu-lsv-box{height:calc(100svh - 6px)!important}}
#m-lesson-viewer.is-expanded,
#m-lesson-viewer.is-native-fullscreen,
#m-lesson-viewer:fullscreen,
#m-lesson-viewer:-webkit-full-screen{
  position:fixed!important;
  inset:0!important;
  width:100vw!important;
  height:100dvh!important;
  max-width:none!important;
  max-height:none!important;
  margin:0!important;
  padding:0!important;
  background:#050d18!important;
  z-index:2147483647!important;
}
#m-lesson-viewer.is-expanded .edu-lsv-box,
#m-lesson-viewer.is-native-fullscreen .edu-lsv-box,
#m-lesson-viewer:fullscreen .edu-lsv-box,
#m-lesson-viewer:-webkit-full-screen .edu-lsv-box{
  width:100vw!important;
  height:100dvh!important;
  max-width:none!important;
  max-height:none!important;
  border:0!important;
  border-radius:0!important;
}
#m-lesson-viewer .edu-lsv-head{
  min-height:50px!important;
  padding:6px 8px!important;
  gap:8px!important;
}
#m-lesson-viewer .edu-lsv-stage{
  padding:0!important;
  min-height:0!important;
}
#m-lesson-viewer .edu-lsv-foot{
  position:absolute!important;
  z-index:8!important;
  left:50%!important;
  bottom:3px!important;
  transform:translateX(-50%)!important;
  width:max-content!important;
  max-width:calc(100% - 18px)!important;
  min-height:0!important;
  padding:3px 8px!important;
  border:1px solid rgba(148,163,184,.18)!important;
  border-radius:999px!important;
  background:rgba(4,9,22,.72)!important;
  backdrop-filter:blur(8px)!important;
  pointer-events:none!important;
  opacity:.72!important;
  white-space:nowrap!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
}
#m-lesson-viewer.is-expanded .edu-lsv-foot,
#m-lesson-viewer.is-native-fullscreen .edu-lsv-foot{opacity:.28!important}
#m-lesson-viewer .edu-lsv-word-reader{width:100%!important;max-width:none!important;margin:0!important}
#m-lesson-viewer .edu-lsv-word-reader .edu-lsv-doc,
#m-lesson-viewer .edu-lsv-text{border-radius:0!important;max-width:none!important}
#m-lesson-viewer .edu-lsv-pdf-local,
#m-lesson-viewer .edu-lsv-pdf-shell,
#m-lesson-viewer .edu-lsv-pdf,
#m-lesson-viewer .edu-lsv-pdf-pages{width:100%!important;max-width:none!important;border-radius:0!important}
#m-lesson-viewer .edu-lsv-pdf-tools{min-height:40px!important;padding:4px 6px!important}
#m-lesson-viewer .edu-lsv-pdf-scroll{padding:2px!important;align-items:center!important;justify-content:center!important}
#m-lesson-viewer .edu-lsv-slide-viewport{padding:2px!important}
#m-lesson-viewer .edu-lsv-presentation-reader .edu-lsv-slide-wrap{width:100%!important;max-width:none!important}
#m-lesson-viewer .edu-lsv-sheet{border-radius:0!important;border-inline:0!important}

/* Preserve complete words and Arabic joining in every text-producing reader. */
#m-lesson-viewer :is(.edu-lsv-doc,.edu-lsv-text,.edu-lsv-slide-el,.edu-lsv-sheet td,.edu-lsv-sheet th,.edu-lsv-archive,.edu-lsv-binary,.edu-lsv-office-local-fallback),
#m-lesson-viewer :is(.edu-lsv-doc,.edu-lsv-text,.edu-lsv-slide-el,.edu-lsv-sheet td,.edu-lsv-sheet th,.edu-lsv-archive,.edu-lsv-binary,.edu-lsv-office-local-fallback) *:not(pre):not(code){
  letter-spacing:normal!important;
  word-spacing:normal!important;
  font-kerning:normal!important;
  font-variant-ligatures:common-ligatures contextual!important;
  text-rendering:optimizeLegibility!important;
  word-break:normal!important;
  overflow-wrap:break-word!important;
  hyphens:manual!important;
}
#m-lesson-viewer :is([dir="rtl"],:lang(ar)){
  font-family:"Tajawal","Amiri","Noto Sans Arabic",Arial,sans-serif!important;
  font-feature-settings:"rlig" 1,"liga" 1,"calt" 1,"kern" 1!important;
  font-variant-ligatures:common-ligatures contextual!important;
}
#m-lesson-viewer :is([dir="ltr"],:lang(en),:lang(fr),:lang(it),:lang(de)){
  font-feature-settings:"liga" 1,"clig" 1,"kern" 1!important;
}
#m-lesson-viewer pre,#m-lesson-viewer code{word-break:normal!important;overflow-wrap:normal!important;font-variant-ligatures:none!important}

@media(max-width:720px){
  #m-lesson-viewer{padding:0!important}
  #m-lesson-viewer .edu-lsv-box{width:100vw!important;height:100dvh!important;border-radius:0!important}
  #m-lesson-viewer .edu-lsv-head{min-height:48px!important;padding:4px 6px!important}
  #m-lesson-viewer .edu-lsv-foot{bottom:2px!important;font-size:.46rem!important;max-width:calc(100% - 10px)!important}
}

/* Keep zoomed PDF pages fully reachable from both horizontal edges. */
#m-lesson-viewer .edu-lsv-pdf-scroll{
  display:block!important;
  text-align:center!important;
}
#m-lesson-viewer #edu-lsv-pdf-canvas{
  margin:0 auto!important;
}

/* 4.0.39.19.7 — one explicit colour system for every reader surface.
   The file is loaded last, therefore this section is intentionally the final
   authority over legacy !important dark backgrounds. The document itself
   (a PDF page, image, video, slide, or authored HTML) is never colour-inverted. */
#m-lesson-viewer,
#m-lesson-viewer[data-theme="dark"] {
  color-scheme:dark;
  --edu-reader-overlay:#020617;
  --edu-reader-shell:#07111f;
  --edu-reader-panel:#050e1b;
  --edu-reader-stage:#0b1320;
  --edu-reader-stage-soft:#111c2d;
  --edu-reader-card:#111827;
  --edu-reader-input:#07101d;
  --edu-reader-text:#e5edf5;
  --edu-reader-muted:#94a3b8;
  --edu-reader-line:#334155;
  --edu-reader-button:#111c2d;
  --edu-reader-button-hover:#12302f;
  --edu-reader-accent:#5eead4;
  --edu-reader-paper:#111827;
  --edu-reader-paper-text:#e5e7eb;
  --edu-reader-code:#07101d;
  --edu-reader-code-head:#0d1929;
  --edu-reader-shadow:rgba(0,0,0,.52);
}

#app[data-theme="light"] #m-lesson-viewer,
#m-lesson-viewer[data-theme="light"] {
  color-scheme:light;
  --edu-reader-overlay:rgba(226,232,240,.92);
  --edu-reader-shell:#ffffff;
  --edu-reader-panel:#f8fafc;
  --edu-reader-stage:#e9eff6;
  --edu-reader-stage-soft:#f1f5f9;
  --edu-reader-card:#ffffff;
  --edu-reader-input:#ffffff;
  --edu-reader-text:#172033;
  --edu-reader-muted:#64748b;
  --edu-reader-line:#cbd5e1;
  --edu-reader-button:#ffffff;
  --edu-reader-button-hover:#ecfdf5;
  --edu-reader-accent:#0f766e;
  --edu-reader-paper:#ffffff;
  --edu-reader-paper-text:#1f2937;
  --edu-reader-code:#f8fafc;
  --edu-reader-code-head:#eef2f7;
  --edu-reader-shadow:rgba(15,23,42,.18);
}

#m-lesson-viewer,
#m-lesson-viewer.is-expanded,
#m-lesson-viewer.is-native-fullscreen,
#m-lesson-viewer:fullscreen,
#m-lesson-viewer:-webkit-full-screen {
  background:var(--edu-reader-overlay)!important;
  color:var(--edu-reader-text)!important;
}

#m-lesson-viewer .edu-lsv-box {
  background:var(--edu-reader-shell)!important;
  color:var(--edu-reader-text)!important;
  border-color:var(--edu-reader-line)!important;
  box-shadow:0 28px 90px var(--edu-reader-shadow)!important;
}

#m-lesson-viewer .edu-lsv-head {
  background:var(--edu-reader-panel)!important;
  color:var(--edu-reader-text)!important;
  border-color:var(--edu-reader-line)!important;
}

#m-lesson-viewer .edu-lsv-title-wrap strong { color:var(--edu-reader-text)!important; }
#m-lesson-viewer .edu-lsv-title-wrap span,
#m-lesson-viewer #edu-lsv-page,
#m-lesson-viewer .edu-lsv-foot { color:var(--edu-reader-muted)!important; }

#m-lesson-viewer .edu-lsv-type {
  background:color-mix(in srgb,var(--edu-reader-accent) 12%,transparent)!important;
  color:var(--edu-reader-accent)!important;
}

#m-lesson-viewer .edu-lsv-actions button,
#m-lesson-viewer .edu-lsv-actions a,
#m-lesson-viewer .edu-lsv-format-tools button,
#m-lesson-viewer .edu-lsv-sheet-tools button,
#m-lesson-viewer .edu-lsv-sheet-pager button,
#m-lesson-viewer .edu-lsv-sheet-switch,
#m-lesson-viewer .edu-lsv-pdf-tools button,
#m-lesson-viewer .edu-lsv-native-pdf-tools button {
  background:var(--edu-reader-button)!important;
  color:var(--edu-reader-text)!important;
  border-color:var(--edu-reader-line)!important;
}

#m-lesson-viewer .edu-lsv-actions button:hover,
#m-lesson-viewer .edu-lsv-actions a:hover,
#m-lesson-viewer .edu-lsv-format-tools button:hover,
#m-lesson-viewer .edu-lsv-format-tools button.active,
#m-lesson-viewer .edu-lsv-pdf-tools button:hover,
#m-lesson-viewer .edu-lsv-pdf-tools button.active {
  background:var(--edu-reader-button-hover)!important;
  color:var(--edu-reader-accent)!important;
  border-color:var(--edu-reader-accent)!important;
}

#m-lesson-viewer .edu-lsv-stage {
  background:
    radial-gradient(circle at 15% 0,color-mix(in srgb,var(--edu-reader-accent) 8%,transparent),transparent 32%),
    var(--edu-reader-stage)!important;
  color:var(--edu-reader-text)!important;
}

#m-lesson-viewer .edu-lsv-foot {
  background:color-mix(in srgb,var(--edu-reader-panel) 88%,transparent)!important;
  border-color:var(--edu-reader-line)!important;
}

/* PDF: theme every surrounding surface and toolbar, not the authored page. */
#m-lesson-viewer .edu-lsv-stage.is-pdf-native,
#m-lesson-viewer .edu-lsv-native-pdf,
#m-lesson-viewer .edu-lsv-pdf-local,
#m-lesson-viewer .edu-lsv-pdf-shell,
#m-lesson-viewer .edu-lsv-pdf,
#m-lesson-viewer .edu-lsv-pdf-pages,
#m-lesson-viewer .edu-lsv-pdf-scroll {
  background:var(--edu-reader-stage)!important;
  color:var(--edu-reader-text)!important;
}

#m-lesson-viewer .edu-lsv-pdf-tools,
#m-lesson-viewer .edu-lsv-format-tools,
#m-lesson-viewer .edu-lsv-sheet-tools,
#m-lesson-viewer .edu-lsv-sheet-tabs-row,
#m-lesson-viewer .edu-lsv-sheet-pager {
  background:var(--edu-reader-panel)!important;
  color:var(--edu-reader-text)!important;
  border-color:var(--edu-reader-line)!important;
}

/* HTML/source workbench and generated previews. */
#m-lesson-viewer .edu-lsv-html-shell,
#m-lesson-viewer .edu-lsv-html-loading,
#m-lesson-viewer .edu-lsv-html-preview,
#m-lesson-viewer .edu-lsv-code-workbench,
#m-lesson-viewer .edu-lsv-code-view,
#m-lesson-viewer .edu-lsv-code-lines li::before {
  background:var(--edu-reader-code)!important;
  color:var(--edu-reader-text)!important;
  border-color:var(--edu-reader-line)!important;
}

/* Match and exceed the specificity of the legacy light rule that deliberately
   kept the source workbench dark. */
#app[data-theme="light"] #m-lesson-viewer .edu-lsv-code-workbench,
#app[data-theme="light"] #m-lesson-viewer .edu-lsv-code-view,
#app[data-theme="light"] #m-lesson-viewer .edu-lsv-code-lines li::before,
#m-lesson-viewer[data-theme="light"] .edu-lsv-code-workbench,
#m-lesson-viewer[data-theme="light"] .edu-lsv-code-view,
#m-lesson-viewer[data-theme="light"] .edu-lsv-code-lines li::before {
  background:var(--edu-reader-code)!important;
  color:var(--edu-reader-text)!important;
  border-color:var(--edu-reader-line)!important;
}

#m-lesson-viewer .edu-lsv-code-tools {
  background:var(--edu-reader-code-head)!important;
  color:var(--edu-reader-text)!important;
  border-color:var(--edu-reader-line)!important;
}

#m-lesson-viewer .edu-lsv-code-tools button {
  background:var(--edu-reader-button)!important;
  color:var(--edu-reader-muted)!important;
  border-color:var(--edu-reader-line)!important;
}

#m-lesson-viewer .edu-lsv-code-tools button.active {
  background:var(--edu-reader-button-hover)!important;
  color:var(--edu-reader-accent)!important;
  border-color:var(--edu-reader-accent)!important;
}

#m-lesson-viewer .edu-lsv-code-lines { color:var(--edu-reader-text)!important; }
#app[data-theme="light"] #m-lesson-viewer .edu-lsv-code-lines .tok-comment,
#m-lesson-viewer[data-theme="light"] .edu-lsv-code-lines .tok-comment { color:#64748b!important; }
#app[data-theme="light"] #m-lesson-viewer .edu-lsv-code-lines .tok-tag,
#app[data-theme="light"] #m-lesson-viewer .edu-lsv-code-lines .tok-keyword,
#m-lesson-viewer[data-theme="light"] .edu-lsv-code-lines .tok-tag,
#m-lesson-viewer[data-theme="light"] .edu-lsv-code-lines .tok-keyword { color:#0f766e!important; }
#app[data-theme="light"] #m-lesson-viewer .edu-lsv-code-lines .tok-string,
#m-lesson-viewer[data-theme="light"] .edu-lsv-code-lines .tok-string { color:#92400e!important; }
#app[data-theme="light"] #m-lesson-viewer .edu-lsv-code-lines .tok-number,
#m-lesson-viewer[data-theme="light"] .edu-lsv-code-lines .tok-number { color:#7e22ce!important; }

/* Locally rendered Office/text/spreadsheet surfaces follow the chosen mode. */
#m-lesson-viewer .edu-lsv-word-reader,
#m-lesson-viewer .edu-lsv-slide-wrap,
#m-lesson-viewer .edu-lsv-slide-viewport,
#m-lesson-viewer .edu-lsv-presentation-reader,
#m-lesson-viewer .edu-lsv-image-reader,
#m-lesson-viewer .edu-lsv-image-scroll,
#m-lesson-viewer .edu-lsv-program-visual,
#m-lesson-viewer .edu-lsv-office-web,
#m-lesson-viewer .edu-lsv-office-web-loading {
  background:var(--edu-reader-stage)!important;
  color:var(--edu-reader-text)!important;
}

#m-lesson-viewer .edu-lsv-word-reader .edu-lsv-doc,
#m-lesson-viewer .edu-lsv-text,
#m-lesson-viewer .edu-lsv-sheet,
#m-lesson-viewer .edu-lsv-sheet-grid,
#m-lesson-viewer .edu-lsv-sheet-grid th,
#m-lesson-viewer .edu-lsv-sheet-grid td,
#m-lesson-viewer .edu-lsv-sheet-meta,
#m-lesson-viewer .edu-lsv-office-local-fallback {
  background:var(--edu-reader-paper)!important;
  color:var(--edu-reader-paper-text)!important;
  border-color:var(--edu-reader-line)!important;
}

#m-lesson-viewer .edu-lsv-sheet-grid thead th,
#m-lesson-viewer .edu-lsv-sheet-grid .edu-lsv-sheet-row,
#m-lesson-viewer .edu-lsv-sheet-grid .edu-lsv-sheet-corner,
#m-lesson-viewer .edu-lsv-sheet-tabs,
#m-lesson-viewer .edu-lsv-sheet-metrics > span {
  background:var(--edu-reader-stage-soft)!important;
  color:var(--edu-reader-text)!important;
  border-color:var(--edu-reader-line)!important;
}

#m-lesson-viewer .edu-lsv-sheet-search {
  background:var(--edu-reader-input)!important;
  border-color:var(--edu-reader-line)!important;
}
#m-lesson-viewer .edu-lsv-sheet-search input { color:var(--edu-reader-text)!important; }
#m-lesson-viewer .edu-lsv-word-meta,
#m-lesson-viewer .edu-lsv-office-local-fallback p,
#m-lesson-viewer .edu-lsv-sheet-tools > span,
#m-lesson-viewer .edu-lsv-sheet-range,
#m-lesson-viewer .edu-lsv-sheet-metrics small { color:var(--edu-reader-muted)!important; }

#m-lesson-viewer .edu-lsv-office-local-button {
  background:color-mix(in srgb,var(--edu-reader-panel) 92%,transparent)!important;
  color:var(--edu-reader-text)!important;
  border-color:var(--edu-reader-line)!important;
}

/* Archive and binary inspectors already use variables; bind them to the same
   theme instead of allowing the old dark fallback variables to leak through. */
#m-lesson-viewer .edu-lsv-archive,
#m-lesson-viewer .edu-lsv-binary {
  --card:var(--edu-reader-card);
  --input:var(--edu-reader-input);
  --line:var(--edu-reader-line);
  --accent:var(--edu-reader-accent);
  background:var(--edu-reader-stage)!important;
  color:var(--edu-reader-text)!important;
}

#m-lesson-viewer .edu-lsv-archive-tools,
#m-lesson-viewer .edu-lsv-archive-row,
#m-lesson-viewer .edu-lsv-archive-back,
#m-lesson-viewer .edu-lsv-binary-head,
#m-lesson-viewer .edu-lsv-binary dl > div,
#m-lesson-viewer .edu-lsv-binary section {
  background:var(--edu-reader-card)!important;
  color:var(--edu-reader-text)!important;
  border-color:var(--edu-reader-line)!important;
}

/* 4.0.39.19.35 — minimal PDF chrome + header tools + touch pinch zoom.
   The PDF page remains an untouched PDF.js canvas; only surrounding UI changes. */
#m-lesson-viewer .edu-lsv-actions button.hidden,
#m-lesson-viewer .edu-lsv-actions #edu-lsv-pdf-menu-head.hidden { display:none!important; }
#m-lesson-viewer:not(.is-pdf-viewer) #edu-lsv-pdf-menu-head { display:none!important; }

#m-lesson-viewer.is-pdf-viewer {
  padding:0!important;
  align-items:stretch!important;
  justify-content:stretch!important;
}
#m-lesson-viewer.is-pdf-viewer .edu-lsv-box {
  width:100vw!important;
  height:100dvh!important;
  max-width:none!important;
  max-height:none!important;
  border:0!important;
  border-radius:0!important;
  box-shadow:none!important;
  grid-template-rows:40px minmax(0,1fr)!important;
}
@supports(height:100svh){#m-lesson-viewer.is-pdf-viewer .edu-lsv-box{height:100svh!important}}
#m-lesson-viewer.is-pdf-viewer .edu-lsv-head {
  display:grid!important;
  grid-template-columns:minmax(0,1fr) auto!important;
  min-height:40px!important;
  height:40px!important;
  max-height:40px!important;
  padding:2px 5px!important;
  gap:4px!important;
  overflow:hidden!important;
  flex-wrap:nowrap!important;
  border-bottom-width:1px!important;
}
#m-lesson-viewer.is-pdf-viewer .edu-lsv-title-wrap { min-width:0!important; gap:3px!important; }
#m-lesson-viewer.is-pdf-viewer .edu-lsv-title-wrap strong {
  font-size:clamp(.66rem,1.2vw,.78rem)!important;
  line-height:1.1!important;
  white-space:nowrap!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
}
#m-lesson-viewer.is-pdf-viewer #edu-lsv-archive-back-head,
#m-lesson-viewer.is-pdf-viewer #edu-lsv-page,
#m-lesson-viewer.is-pdf-viewer #edu-lsv-download,
#m-lesson-viewer.is-pdf-viewer #edu-lsv-fullscreen { display:none!important; }
#m-lesson-viewer.is-pdf-viewer #edu-lsv-pdf-menu-head:not(.hidden),
#m-lesson-viewer.is-pdf-viewer #edu-lsv-close {
  display:inline-flex!important;
  width:32px!important;
  min-width:32px!important;
  height:32px!important;
  min-height:32px!important;
  padding:0!important;
  align-items:center!important;
  justify-content:center!important;
  border-radius:8px!important;
}
#m-lesson-viewer.is-pdf-viewer .edu-lsv-actions {
  display:flex!important;
  align-items:center!important;
  justify-content:flex-end!important;
  gap:3px!important;
  min-height:32px!important;
  overflow:visible!important;
}
#m-lesson-viewer.is-pdf-viewer #edu-lsv-pdf-menu-head[aria-expanded="true"] {
  color:var(--edu-reader-accent)!important;
  border-color:var(--edu-reader-accent)!important;
  background:var(--edu-reader-button-hover)!important;
}
#m-lesson-viewer.is-pdf-viewer .edu-lsv-stage {
  padding:0!important;
  overflow:hidden!important;
  min-height:0!important;
  border:0!important;
  background:var(--edu-reader-stage)!important;
}
#m-lesson-viewer.is-pdf-viewer .edu-lsv-foot { display:none!important; }
#m-lesson-viewer.is-pdf-viewer .edu-lsv-watermark { inset-block-end:0!important; }

#m-lesson-viewer.is-pdf-viewer .edu-lsv-pdf-local {
  position:relative!important;
  width:100%!important;
  height:100%!important;
  min-width:0!important;
  min-height:0!important;
  overflow:hidden!important;
  border:0!important;
  border-radius:0!important;
}
#m-lesson-viewer.is-pdf-viewer .edu-lsv-pdf-scroll {
  position:absolute!important;
  inset:0!important;
  width:100%!important;
  height:100%!important;
  min-width:0!important;
  min-height:0!important;
  padding:0!important;
  margin:0!important;
  overflow:auto!important;
  direction:ltr!important;
  text-align:initial!important;
  scrollbar-gutter:auto!important;
  overscroll-behavior:contain!important;
  -webkit-overflow-scrolling:touch!important;
  touch-action:pan-x pan-y!important;
}
#m-lesson-viewer.is-pdf-viewer .edu-lsv-pdf-pages {
  display:flex!important;
  flex-direction:column!important;
  align-items:center!important;
  width:max-content!important;
  min-width:100%!important;
  min-height:100%!important;
  gap:4px!important;
  padding:2px!important;
  margin:0!important;
  box-sizing:border-box!important;
  direction:ltr!important;
}
#m-lesson-viewer.is-pdf-viewer .edu-lsv-pdf-page {
  flex:0 0 auto!important;
  margin:0 auto!important;
  border:0!important;
  border-radius:0!important;
  box-shadow:0 1px 4px rgba(0,0,0,.16)!important;
  background:#fff!important;
}
#m-lesson-viewer.is-pdf-viewer .edu-lsv-pdf-page::after { display:none!important; }
#m-lesson-viewer.is-pdf-viewer .edu-lsv-pdf-page-canvas {
  display:block!important;
  max-width:none!important;
  max-height:none!important;
  margin:0!important;
  background:#fff!important;
  pointer-events:none!important;
  image-rendering:auto!important;
}

/* Drawer is anchored below the header settings button; it only contains
   zoom-out, zoom-in, download and fullscreen. */
#m-lesson-viewer.is-pdf-viewer .edu-lsv-pdf-menu {
  position:absolute!important;
  z-index:30!important;
  inset-block-start:5px!important;
  inset-inline-end:5px!important;
  width:auto!important;
  max-width:calc(100% - 10px)!important;
  padding:6px!important;
  border:1px solid var(--edu-reader-line)!important;
  border-radius:10px!important;
  background:color-mix(in srgb,var(--edu-reader-panel) 96%,transparent)!important;
  color:var(--edu-reader-text)!important;
  box-shadow:0 10px 28px rgba(0,0,0,.24)!important;
  backdrop-filter:blur(10px)!important;
  direction:ltr!important;
}
#m-lesson-viewer.is-pdf-viewer .edu-lsv-pdf-menu[hidden] { display:none!important; }
#m-lesson-viewer.is-pdf-viewer .edu-lsv-pdf-menu-status { display:none!important; }
#m-lesson-viewer.is-pdf-viewer .edu-lsv-pdf-menu-grid {
  display:grid!important;
  grid-template-columns:repeat(2,34px)!important;
  gap:4px!important;
}
#m-lesson-viewer.is-pdf-viewer .edu-lsv-pdf-menu-grid button,
#m-lesson-viewer.is-pdf-viewer .edu-lsv-pdf-menu-grid a {
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  width:34px!important;
  min-width:34px!important;
  height:34px!important;
  min-height:34px!important;
  padding:0!important;
  margin:0!important;
  border:1px solid var(--edu-reader-line)!important;
  border-radius:8px!important;
  background:var(--edu-reader-button)!important;
  color:var(--edu-reader-text)!important;
  text-decoration:none!important;
}
#m-lesson-viewer.is-pdf-viewer .edu-lsv-pdf-menu-grid .hidden { display:none!important; }
#m-lesson-viewer.is-pdf-viewer .edu-lsv-pdf-menu-grid button:hover,
#m-lesson-viewer.is-pdf-viewer .edu-lsv-pdf-menu-grid button:focus-visible,
#m-lesson-viewer.is-pdf-viewer .edu-lsv-pdf-menu-grid a:hover,
#m-lesson-viewer.is-pdf-viewer .edu-lsv-pdf-menu-grid a:focus-visible {
  color:var(--edu-reader-accent)!important;
  border-color:var(--edu-reader-accent)!important;
  background:var(--edu-reader-button-hover)!important;
  outline:0!important;
}

@media(max-width:700px){
  #m-lesson-viewer.is-pdf-viewer .edu-lsv-box{grid-template-rows:38px minmax(0,1fr)!important}
  #m-lesson-viewer.is-pdf-viewer .edu-lsv-head{
    min-height:38px!important;height:38px!important;max-height:38px!important;
    padding:2px max(4px,env(safe-area-inset-right)) 2px max(4px,env(safe-area-inset-left))!important;
  }
  #m-lesson-viewer.is-pdf-viewer #edu-lsv-pdf-menu-head:not(.hidden),
  #m-lesson-viewer.is-pdf-viewer #edu-lsv-close{
    width:31px!important;min-width:31px!important;height:31px!important;min-height:31px!important;
  }
  #m-lesson-viewer.is-pdf-viewer .edu-lsv-pdf-pages{gap:2px!important;padding:0!important}
  #m-lesson-viewer.is-pdf-viewer .edu-lsv-pdf-page{box-shadow:none!important}
  #m-lesson-viewer.is-pdf-viewer .edu-lsv-pdf-menu{inset-block-start:4px!important;inset-inline-end:4px!important;padding:5px!important}
  #m-lesson-viewer.is-pdf-viewer .edu-lsv-pdf-menu-grid{grid-template-columns:repeat(2,36px)!important}
  #m-lesson-viewer.is-pdf-viewer .edu-lsv-pdf-menu-grid button,
  #m-lesson-viewer.is-pdf-viewer .edu-lsv-pdf-menu-grid a{width:36px!important;min-width:36px!important;height:36px!important;min-height:36px!important}
}



/* v4.0.39.19.43 — HTML-first viewer + download-only archives. */
#m-lesson-viewer.is-code-viewer .edu-lsv-stage.is-code{padding:0!important;overflow:hidden!important}
#m-lesson-viewer.is-code-viewer .edu-lsv-code-workbench{width:100%!important;height:100%!important;min-height:0!important;border:0!important;border-radius:0!important;box-shadow:none!important}
#m-lesson-viewer.is-code-viewer .edu-lsv-html-preview.active{display:block!important;width:100%!important;height:100%!important;min-height:0!important;padding:0!important;overflow:hidden!important;background:#fff!important}
#m-lesson-viewer.is-code-viewer .edu-lsv-html-preview iframe{display:block!important;width:100%!important;height:100%!important;min-height:100%!important;border:0!important;background:#fff!important}
#m-lesson-viewer .edu-lsv-archive-nav,#m-lesson-viewer .edu-lsv-archive-list,#m-lesson-viewer .edu-lsv-archive-menu{display:none!important}
