/* Shared classroom chrome for full-document lessons and live chapter pages. */
body.tm-shell-body {
  --tm-ink: #102b3d;
  --tm-muted: #4c6170;
  --tm-teal: #006454;
  --tm-surface: #fffdfa;
  --tm-ivory: #fbf7ee;
  --tm-line: #e4ddd2;
  --tm-width: min(77rem, calc(100% - clamp(2rem, 7vw, 6.5rem)));
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
  max-width: none !important;
  min-height: 100% !important;
  background: var(--tm-surface) url("/brand/classroom-page-pattern.svg") center top / 74rem 41rem !important;
  overflow-x: hidden !important;
}

.tm-shell-body > :is(.tm-site-header, .tm-reader-bar, .tm-pager, .tm-site-footer, .tm-live-chapter) {
  box-sizing: border-box;
  font: 500 1rem/1.5 system-ui, -apple-system, "Myanmar Text", sans-serif;
  color: var(--tm-ink);
  letter-spacing: normal;
  text-transform: none;
}

.tm-shell-body > :is(.tm-site-header, .tm-reader-bar, .tm-pager, .tm-site-footer, .tm-live-chapter) * {
  box-sizing: border-box;
}

.tm-shell-body > :is(.tm-site-header, .tm-reader-bar, .tm-pager, .tm-site-footer, .tm-live-chapter) a {
  color: var(--tm-teal) !important;
  text-decoration: none !important;
}

.tm-shell-body > :is(.tm-site-header, .tm-reader-bar, .tm-pager, .tm-site-footer, .tm-live-chapter) :focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 3px;
}

.tm-shell-body > .tm-site-header {
  position: sticky !important;
  z-index: 10000 !important;
  top: 0 !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-bottom: 1px solid var(--tm-line) !important;
  background: var(--tm-surface) !important;
  box-shadow: none !important;
  text-align: start !important;
}

.tm-header-inner,
.tm-footer-inner {
  width: var(--tm-width);
  margin-inline: auto;
}

.tm-header-inner {
  display: grid;
  grid-template-columns: minmax(max-content, 1fr) auto minmax(max-content, 1fr);
  align-items: center;
  gap: .75rem;
  min-height: 4.75rem;
}

.tm-site-header .tm-brand {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: .7rem;
  color: var(--tm-ink) !important;
  font-size: clamp(.9rem, 1.45vw, 1.19rem);
  font-weight: 760;
  letter-spacing: -.024em;
  white-space: nowrap;
}

.tm-site-header .tm-brand img {
  display: block !important;
  width: 2.5rem !important;
  height: 2.5rem !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  box-shadow: none !important;
}

.tm-primary-nav {
  display: flex;
  align-items: center;
  gap: .7rem clamp(.8rem, 2vw, 1.9rem);
  font-size: .9rem;
  font-weight: 650;
}

.tm-site-header .tm-primary-nav a { color: var(--tm-muted) !important; white-space: nowrap; }
.tm-site-header .tm-primary-nav a:is(:hover, :focus-visible, [aria-current="page"]) { color: var(--tm-teal) !important; }
.tm-site-header .tm-primary-nav a[hidden] { display: none !important; }
@media (min-width: 901px) {
  .tm-site-header .tm-primary-nav :is(a[href="/privacy/"], a[href="/terms/"]) { display: none !important; }
}

.tm-header-tools {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: .7rem;
}

.tm-site-header :is(.tm-account, .tm-menu) {
  color: var(--tm-ink) !important;
  background: var(--tm-surface) !important;
  border: 1px solid #c9d9df !important;
  border-radius: .55rem !important;
  cursor: pointer;
  line-height: 1.1 !important;
}

.tm-site-header .tm-account {
  justify-self: end;
  min-height: 2.5rem;
  padding: .35rem .85rem !important;
  font: 700 .83rem/1.2 system-ui, sans-serif !important;
  white-space: nowrap;
}

.tm-site-header .tm-account:hover { background: #e7f5f1 !important; }
.tm-site-header .tm-menu { display: none !important; width: 2.65rem; height: 2.65rem; }
.tm-site-header .tm-mobile-account { display: none; }

.tm-shell-body > .tm-reader-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem 1.5rem;
  width: var(--tm-width);
  margin: clamp(1rem, 2.6vw, 1.8rem) auto 1rem;
  padding: clamp(.9rem, 2.5vw, 1.55rem);
  border: 1px solid var(--tm-line);
  border-radius: 1rem;
  background: var(--tm-ivory) url("/brand/hero-classroom-desktop.svg") center / 100% 100% no-repeat;
}

.tm-reader-trail { display: grid; min-width: 0; gap: .45rem; }
.tm-reader-trail a {
  justify-self: start;
  border-radius: .4rem;
  padding: .25rem .55rem;
  background: #ffdde8;
  color: #6f2243 !important;
  font-size: .77rem;
  font-weight: 750;
}
.tm-shell-body > .tm-reader-bar .tm-reader-trail a { color: #6f2243 !important; }

.tm-reader-trail strong {
  color: var(--tm-ink);
  font-size: clamp(1.15rem, 3.25vw, 1.95rem);
  font-weight: 790;
  letter-spacing: -.035em;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.tm-reader-nav { display: flex; align-items: center; justify-content: space-between; gap: .4rem; white-space: nowrap; }
.tm-reader-nav > :is(a, span) { padding: .5rem .57rem; font-size: .82rem; color: var(--tm-muted); }
.tm-reader-nav a, .tm-reader-nav [aria-disabled="true"] { border: 1px solid #b4d5cb; border-radius: .5rem; background: #edf9f4; }
.tm-reader-nav a:hover { background: #d1f1e4; }
.tm-reader-nav [aria-disabled="true"] { color: var(--tm-muted); opacity: .65; }

.tm-shell-body > .tm-document {
  display: block;
  width: 100%;
  max-width: none;
  min-height: 50vh;
  margin: 0;
  padding: .5rem 0;
}

/* Compact navigation above the lesson and linked title cards below it. */
.tm-shell-body > .tm-pager:has(+ .tm-document) { display: none; }
.tm-shell-body > .tm-pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .85rem;
  width: var(--tm-width);
  margin: 1.4rem auto 1.7rem;
}
.tm-shell-body > .tm-pager > span { display: none; }
.tm-shell-body > .tm-pager:not(:has(a)) { display: none; }
.tm-pager a {
  display: grid;
  align-content: start;
  gap: .2rem;
  min-width: 0;
  padding: .9rem 1rem;
  border: 1px solid #acd3c7;
  border-radius: .8rem;
  background: #e7f6ef;
  overflow-wrap: anywhere;
}
.tm-pager a:only-of-type { grid-column: 1 / -1; }
.tm-pager a:hover { background: #d1f1e4; }
.tm-pager-next { text-align: end; }
.tm-pager-label { color: var(--tm-teal); font-size: .79rem; font-weight: 750; }
.tm-pager strong { color: var(--tm-ink); font-size: .98rem; font-weight: 750; }
.tm-pager-meta { color: var(--tm-muted); font-size: .77rem; }

.tm-shell-body > .tm-site-footer {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  background: rgb(251 247 238 / 65%);
  border-top: 1px solid var(--tm-line);
  text-align: start;
}

.tm-footer-inner {
  display: flex;
  min-height: 5.5rem;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: .6rem 1.2rem;
  padding-block: 1rem;
  color: var(--tm-muted);
  font-size: .86rem;
}

.tm-footer-inner strong { color: var(--tm-ink); }
.tm-footer-links { display: flex; flex-wrap: wrap; gap: .55rem 1.05rem; }
.tm-shell-body > .tm-site-footer a:hover { text-decoration: underline !important; }

.tm-shell-body > .tm-live-chapter { width: var(--tm-width); margin: 1.5rem auto 3rem; }
.tm-live-chapter h1 { margin-block: .65rem; font-size: clamp(1.7rem, 5vw, 3.5rem); letter-spacing: -.045em; overflow-wrap: anywhere; }
.tm-reader-notice {
  width: min(100%, 42rem);
  margin: clamp(2rem, 7vw, 5rem) auto;
  padding: clamp(1rem, 5vw, 3rem);
  border: 1px solid #e9afc2;
  border-radius: 1rem;
  background: var(--tm-surface);
}
.tm-reader-notice .tm-pager-label { color: #8b3355; }
.tm-reader-notice a { font-weight: 700; }
.tm-live-chapter .tm-lesson-section { margin: 1rem 0; border: 1px solid #e9afc2; border-radius: 1rem; background: var(--tm-surface); }
.tm-live-chapter .tm-lesson-section h2 { margin: 0; padding: .75rem 1rem; border-radius: .9rem .9rem 0 0; background: #ffe4ed; color: #6f2243; font-size: 1.25rem; }
.tm-live-chapter .tm-lesson-section a { display: block; padding: .78rem 1rem; border-top: 1px solid var(--tm-line); overflow-wrap: anywhere; }

@media (max-width: 900px) {
  .tm-header-inner { min-height: 4rem; grid-template-columns: minmax(0, 1fr) auto; gap: 0 .4rem; }
  .tm-site-header .tm-brand { grid-column: 1; grid-row: 1; gap: .5rem; }
  .tm-site-header .tm-brand img { width: 2.1rem !important; height: 2.1rem !important; }
  .tm-header-tools { grid-column: 2; grid-row: 1; gap: .4rem; }
  .tm-site-header .tm-menu { display: inline-grid !important; place-items: center; }
  .tm-primary-nav { display: none; grid-column: 1 / -1; grid-row: 2; align-items: stretch; gap: 0; padding: .15rem 0 .75rem; }
  .tm-primary-nav.tm-open { display: grid; }
  .tm-primary-nav a { padding: .65rem 0; border-top: 1px solid var(--tm-line); }
}

@media (max-width: 600px) {
  body.tm-shell-body { background-size: 44.4rem 24.6rem !important; }
  .tm-shell-body > .tm-reader-bar { flex-direction: column; align-items: stretch; }
  .tm-shell-body > .tm-pager { grid-template-columns: minmax(0, 1fr); }
  .tm-pager-next { text-align: start; }
}

@media (max-width: 480px) {
  .tm-site-header .tm-brand { min-width: 0; white-space: normal; }
  .tm-site-header .tm-account { padding-inline: .52rem !important; font-size: .76rem !important; }
  .tm-site-header .tm-header-tools:has(.tm-calculator-link) .tm-account { display: none; }
  .tm-site-header .tm-mobile-account { display: block; padding-top: .55rem; border-top: 1px solid var(--tm-line); }
}

@media (max-width: 380px) {
  .tm-site-header .tm-account { min-height: 2.15rem; padding-inline: .42rem !important; font-size: .72rem !important; }
  .tm-site-header .tm-menu { width: 2.15rem; height: 2.15rem; }
}

/* Lesson documents carry their original styles. Keep their content edges
   aligned with the reader banner, including the older guide wrappers. */
.tm-shell-body > #tm-document > :is(.container, .main-wrapper, .post-wrapper, .app, .main-container, .page, article, header) {
  box-sizing: border-box;
  width: var(--tm-width);
  max-width: 100%;
  min-width: 0;
  margin-inline: auto;
}
.tm-shell-body > #tm-document > .post-wrapper {
  padding: 0;
  background: transparent;
}
.tm-shell-body > #tm-document > .post-wrapper > .container {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
}
.tm-shell-body > #tm-document :is(.katex-display, .table-responsive, .math-block) {
  max-width: 100%;
  box-sizing: border-box;
}
.tm-shell-body > #tm-document :is(img, canvas, iframe) { max-width: 100%; }
.tm-shell-body > #tm-document img { height: auto; }
.tm-shell-body > #tm-document .tm-table-scroll {
  max-width: 100%;
  overflow-x: auto;
}
.tm-shell-body > #tm-document .tm-inline-math-scroll {
  display: inline-block;
  max-width: 100%;
  overflow-x: auto;
  vertical-align: middle;
}
@media print {
  .tm-shell-body > #tm-document > :is(.container, .main-wrapper, .post-wrapper, .app, .main-container, .page, article, header) {
    width: 100%;
  }
}
@media (max-width: 600px) {
  .tm-shell-body > #tm-document :is(.dos-box, .donts-box) {
    box-sizing: border-box;
    flex-basis: 100%;
    min-width: 0;
  }
}

/* All numbered sections use the same reader frame and content styles. */
.tm-shell-body > #tm-document.tm-lesson-frame {
  --tm-content-inset: clamp(.75rem, 2.5vw, 1.85rem);
  box-sizing: border-box;
  width: var(--tm-width);
  margin: 0 auto;
  padding: var(--tm-content-inset);
  border: 1px solid var(--tm-line);
  border-radius: 1rem;
  background: var(--tm-surface);
  color: var(--tm-ink);
}
#tm-document.tm-lesson-frame > :is(.container, .main-wrapper, .post-wrapper, .app, .main-container, .page, article, header, .tm-lesson-quiz) {
  width: 100%;
  max-width: 100%;
  margin-inline: 0;
  padding-inline: 0;
  border: 0;
  background-color: transparent;
  box-shadow: none;
}
#tm-document.tm-lesson-frame > .post-wrapper > .container {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}
#tm-document.tm-lesson-frame > .desktop-exercise-bar {
  width: 100%;
  margin-inline: 0;
}
#tm-document.tm-lesson-frame > :is(header, .container, .main-wrapper, .page, article) {
  margin-block-start: 0;
}
#tm-document.tm-lesson-frame > header {
  padding: clamp(.8rem, 2vw, 1.4rem);
  background: var(--tm-ivory);
  border: 1px solid var(--tm-line);
  border-radius: .75rem;
  color: var(--tm-ink);
}
#tm-document.tm-lesson-frame :is(h1, h2, h3) {
  color: var(--tm-ink);
  font-family: system-ui, -apple-system, "Myanmar Text", sans-serif;
  line-height: 1.32;
  overflow-wrap: break-word;
}
#tm-document.tm-lesson-frame h1 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
#tm-document.tm-lesson-frame h2 { font-size: clamp(1.23rem, 2.5vw, 1.65rem); }
#tm-document.tm-lesson-frame h3 { font-size: clamp(1.08rem, 2vw, 1.35rem); }
#tm-document.tm-lesson-frame :is(.desktop-problem-solution, .tm-exercise-disclosure) > summary {
  min-height: 44px;
  padding: .55rem .8rem;
  border: 1px solid #b4d5cc;
  border-radius: .55rem;
  background: #edf8f5;
  color: #075348;
  font: 650 .95rem/1.4 system-ui, sans-serif;
}
#tm-document.tm-lesson-frame :is(.desktop-problem-solution, .tm-exercise-disclosure)[open] > summary {
  background: #dcefe9;
}
@media (max-width: 480px) {
  #tm-document.tm-lesson-frame > .post-wrapper > .container { padding-inline: 0 !important; }
}
@media print {
  .tm-shell-body > #tm-document.tm-lesson-frame {
    width: 100%;
    padding: 0;
    border: 0;
  }
}
@media (max-width: 480px) {
  #tm-document.tm-lesson-frame .solution-body:has(.tm-step-list) {
    grid-template-columns: minmax(0, 1fr);
  }
  #tm-document.tm-lesson-frame .tm-step-list { min-width: 0; }
}
