.ttb-related-materials,
.ttb-related-materials *,
.ttb-related-materials *::before,
.ttb-related-materials *::after { box-sizing: border-box; }

/* The inherited full-page runtime fixes these wrappers at the viewport height.
   Non-lesson panels need to contribute their complete content height before
   the related-product sibling; lessons keep their existing full-page sizing. */
body:is([data-ttobak-screen='learners'], [data-ttobak-screen='progress'],
  [data-ttobak-screen='review'], [data-ttobak-screen='materials'],
  [data-ttobak-screen='adventure']) :is(#dc-root, #dc-root > .sc-host) {
  height: auto !important;
  min-height: 100vh;
}

.ttb-related-materials {
  position: relative;
  width: min(100% - 32px, 1240px);
  margin: 28px auto 0;
  padding: 0;
  color: #4c5546;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  font-family: 'Ttobak Learning', 'Ttobak Home', sans-serif;
  line-height: 1.5;
}
.ttb-related-materials[hidden],
.ttb-related-materials [hidden] { display: none !important; }
.ttb-related-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  flex-wrap: wrap;
  max-width: 1240px;
  margin: 0 auto 12px;
}
.ttb-related-heading { min-width: 0; }
.ttb-related-brand {
  margin: 0 0 2px;
  color: #65705b;
  font-size: 13px;
  font-weight: 500;
}
.ttb-related-heading h2 {
  margin: 0;
  font-family: 'Ttobak Learning', 'Noto Sans CJK KR', 'Malgun Gothic', sans-serif;
  font-weight: 400;
  font-synthesis: none;
  font-size: clamp(20px, 2.2vw, 24px);
  line-height: 1.45;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.ttb-related-decoration {
  display: block;
  width: 72px;
  height: 48px;
  flex: 0 0 72px;
  object-fit: contain;
}
.ttb-related-track {
  display: flex;
  gap: 12px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 0 8px;
  list-style: none;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: #d3d8c7 transparent;
}
.ttb-related-track::-webkit-scrollbar { height: 6px; }
.ttb-related-track::-webkit-scrollbar-thumb { background: #d3d8c7; border-radius: 8px; }
.ttb-related-card {
  flex: 0 0 calc((100% - 24px) / 3);
  min-width: 0;
  padding: 0;
  margin: 0;
  scroll-snap-align: start;
}
.ttb-related-card:last-child { scroll-snap-align: end; }
.ttb-related-card:only-child { flex-basis: min(100%, 320px); margin-inline: auto; }
.ttb-related-product {
  display: block;
  height: 100%;
  padding: 0 0 4px;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: 0;
  text-decoration: none;
  transition: border-color .18s ease, background-color .18s ease;
}
.ttb-related-product:hover .ttb-related-product-title { text-decoration: underline; text-underline-offset: 4px; }
.ttb-related-cover {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 144px;
  padding: 0;
  background: transparent;
  border-radius: 0;
}
.ttb-related-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.ttb-related-product-title {
  display: block;
  margin: 6px 0 3px;
  font-family: 'Ttobak Learning', 'Ttobak Home', sans-serif;
  font-weight: 700;
  font-synthesis: none;
  font-size: 17px;
  line-height: 24px;
  color: #194b40;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.ttb-related-product-description {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  max-height: 48px;
  overflow: hidden;
  margin: 4px 0 6px;
  color: #526550;
  font-family: 'Ttobak Learning', 'Noto Sans CJK KR', 'Malgun Gothic', sans-serif;
  font-size: 15px;
  font-weight: 400;
  font-synthesis: none;
  line-height: 1.6;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.ttb-related-product-link { display: block; color: #617659; font-size: 14px; line-height: 1.6; }
.ttb-related-product-link > span { display: inline-block; margin-left: 3px; }
.ttb-related-count { display: none; }
.ttb-related-materials :focus-visible { outline: 3px solid #598e54; outline-offset: 3px; }
.ttb-related-product:focus-visible { outline-offset: -4px; }
.ttb-related-track:focus-visible { outline-offset: 4px; }
.ttb-related-status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
@media (min-width: 1100px) {
  .ttb-related-card { flex-basis: calc((100% - 60px) / 6); }
}
@media (min-width: 1300px) {
  .ttb-related-materials { width: min(100%, 1320px); padding-inline: 40px; }
  .ttb-related-card { flex-basis: calc((100% - 60px) / 6); }
}
@media (max-width: 599px) {
  .ttb-related-materials { padding: 0; margin-block: 24px 0; }
  .ttb-related-header { margin-bottom: 12px; }
  .ttb-related-track { gap: 12px; }
  .ttb-related-card { flex-basis: calc((100% - 12px) / 2); }
  .ttb-related-product { padding: 0 0 4px; border-radius: 0; }
  .ttb-related-cover { height: 128px; padding: 0; }
  .ttb-related-product-title { font-size: 17px; }
}
@media (prefers-reduced-motion: reduce) {
  .ttb-related-product { transition: none; }
}
@media (forced-colors: active) {
  .ttb-related-materials,
  .ttb-related-product { border-color: CanvasText; }
  .ttb-related-cover { background: Canvas; }
}

/* A restrained clay-like section title, with no new artwork or extra badges. */
body .ttb-related-header h2 {
  font-family:'Ttobak Rounded UI','Ttobak UI','Ttobak Learning',sans-serif;
  font-size:25px;font-weight:400;line-height:1.4;letter-spacing:0;
  color:#315f50;text-shadow:0 1px 0 #fffef5,0 2px 0 #d6ddcd;
  margin:0;
}
@media(max-width:599px){body .ttb-related-header h2{font-size:23px;}}
@media(forced-colors:active){body .ttb-related-header h2{color:CanvasText;text-shadow:none;}}

/* Only the owner-selected related-material title uses the cream label artwork. */
body .ttb-related-header h2.ttb-related-title-cream {
  position:relative;width:216px;max-width:100%;margin:0;text-shadow:none;line-height:1;
}
.ttb-related-title-art {display:block;width:100%;height:auto;max-width:100%;}
.ttb-related-title-text {
  position:absolute;left:50%;top:55%;transform:translate(-50%,-50%);
  padding:0;margin:0;white-space:nowrap;border:0;
  font:400 14.5px/1.25 'Ttobak Rounded UI','Ttobak UI','Ttobak Learning',sans-serif;
  color:#00462d;letter-spacing:0;text-shadow:none;
}
@media(max-width:599px){body .ttb-related-header h2.ttb-related-title-cream{width:192px;}}
@media(max-width:599px){.ttb-related-title-text{font-size:12.9px;}}
@media(forced-colors:active){
 .ttb-related-title-art{display:none;}
 .ttb-related-title-text{position:static;width:auto;height:auto;margin:0;overflow:visible;clip-path:none;white-space:normal;transform:none;color:CanvasText;}
 body .ttb-related-header h2.ttb-related-title-cream{line-height:1.4;color:CanvasText;}
}

/* Reuse the gallery's paper-edge book treatment around intact cover images.
   Symmetric vertical padding centers the complete artwork inside the book. */
.ttb-related-cover{padding:0 5px 5px!important;margin-bottom:9px}
.ttb-related-book{position:relative;display:block;flex:none;height:100%;aspect-ratio:1;width:auto;max-width:100%;padding:4px 0 4px 4px;border-left:3px solid #e4e1d5;border-radius:3px;background:#fffef8;box-shadow:1px 1px 0 #f2efe3,2px 2px 0 #dcded2,3px 3px 0 #f7f6ef,4px 4px 0 #dfe1d6,0 9px 14px -10px #3f574a52}
.ttb-related-book::after{content:'';position:absolute;left:4px;right:0;bottom:2px;height:1px;background:#e2e0d5;pointer-events:none}
.ttb-related-book img{object-fit:contain;object-position:center;border-radius:1px 2px 1px 1px}
@media(forced-colors:active){.ttb-related-book{background:Canvas;border:1px solid CanvasText;box-shadow:none}.ttb-related-book::after{display:none}}
