/* Home treasure map cards: number top-left, picture centered, title horizontal below. */
html body.is-student-home .adventure-map .adventure-node,
html body.is-student-home .adventure-map .adventure-node:nth-child(2n),
html body.is-student-home .adventure-map .adventure-node:nth-child(3n),
html body.is-student-home .adventure-map .adventure-node:nth-child(4n),
html body.is-student-home .adventure-map .adventure-node:nth-child(5n) {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-rows: 76px minmax(150px, 1fr) auto auto !important;
  min-height: 310px !important;
  padding: 22px 20px 24px !important;
  gap: 12px !important;
  overflow: hidden !important;
  align-items: center !important;
  justify-items: center !important;
}

html body.is-student-home .adventure-map .adventure-node::before,
html body.is-student-home .adventure-map .adventure-node::after {
  content: none !important;
  display: none !important;
}

html body.is-student-home .adventure-map .adventure-node__number {
  grid-column: 1 !important;
  grid-row: 1 !important;
  justify-self: start !important;
  align-self: start !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #ff6840 !important;
  font-family: Georgia, "Times New Roman", serif !important;
  font-size: clamp(60px, 5.8vw, 86px) !important;
  font-weight: 900 !important;
  line-height: 0.9 !important;
  text-shadow: 0 3px 0 rgba(255, 223, 145, 0.9) !important;
}

html body.is-student-home .adventure-map .adventure-node__art {
  grid-column: 1 !important;
  grid-row: 2 !important;
  justify-self: center !important;
  align-self: center !important;
  width: min(84%, 200px) !important;
  height: 156px !important;
  max-width: 100% !important;
  overflow: hidden !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  transform: none !important;
}

html body.is-student-home .adventure-map .adventure-node__art-frame,
html body.is-student-home .adventure-map .adventure-node__art .illustration-image-frame,
html body.is-student-home .adventure-map .adventure-node__art .illustration-image,
html body.is-student-home .adventure-map .adventure-node__art img,
html body.is-student-home .adventure-map .adventure-node__art svg {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

html body.is-student-home .adventure-map .adventure-node__content {
  grid-column: 1 !important;
  grid-row: 3 !important;
  width: 100% !important;
  min-width: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  writing-mode: horizontal-tb !important;
}

html body.is-student-home .adventure-map .adventure-node__period {
  display: none !important;
}

html body.is-student-home .adventure-map .adventure-node__title,
html body.is-student-home .adventure-map .adventure-node strong,
html body.is-student-home .adventure-map .adventure-node__title strong {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  writing-mode: horizontal-tb !important;
  white-space: normal !important;
  word-break: keep-all !important;
  overflow-wrap: break-word !important;
  text-align: center !important;
  font-size: clamp(24px, 2.2vw, 34px) !important;
  line-height: 1.25 !important;
  color: #0f2d49 !important;
}

html body.is-student-home .adventure-map .adventure-node__status {
  grid-column: 1 !important;
  grid-row: 4 !important;
  justify-self: center !important;
  align-self: end !important;
  margin: 0 !important;
}

html body.is-student-home .adventure-map .adventure-node__dog {
  left: auto !important;
  right: 20px !important;
  bottom: 20px !important;
}

@media (max-width: 900px) {
  html body.is-student-home .adventure-map .adventure-node,
  html body.is-student-home .adventure-map .adventure-node:nth-child(2n),
  html body.is-student-home .adventure-map .adventure-node:nth-child(3n),
  html body.is-student-home .adventure-map .adventure-node:nth-child(4n),
  html body.is-student-home .adventure-map .adventure-node:nth-child(5n) {
    min-height: 250px !important;
    grid-template-rows: 58px minmax(110px, 1fr) auto auto !important;
    padding: 18px 16px 20px !important;
  }

  html body.is-student-home .adventure-map .adventure-node__number {
    font-size: clamp(46px, 13vw, 66px) !important;
  }

  html body.is-student-home .adventure-map .adventure-node__art {
    width: min(86%, 160px) !important;
    height: 120px !important;
  }

  html body.is-student-home .adventure-map .adventure-node__title,
  html body.is-student-home .adventure-map .adventure-node strong,
  html body.is-student-home .adventure-map .adventure-node__title strong {
    font-size: clamp(21px, 6vw, 28px) !important;
  }
}

/* codex treasure-map compact card polish */
:where([class*="treasure"], [class*="map"], [class*="lesson-map"]) :where([class*="route"], [class*="trail"], [class*="path"], [class*="compass"], [class*="wheel"], [class*="spinner"]) {
  display: none !important;
}
:where([class*="treasure"], [class*="map"], [class*="lesson-map"]) :where(a, button, article, li, div, span, h2, h3, p) {
  writing-mode: horizontal-tb !important;
  text-orientation: mixed !important;
}
:where([class*="treasure"], [class*="map"], [class*="lesson-map"]) :where([class*="lesson"], [class*="card"], [class*="tile"]) {
  align-items: center !important;
  justify-content: space-between !important;
}
:where([class*="treasure"], [class*="map"], [class*="lesson-map"]) img {
  max-width: 78% !important;
  max-height: 150px !important;
  object-fit: contain !important;
  border: 0 !important;
  box-shadow: none !important;
}
:where([class*="treasure"], [class*="map"], [class*="lesson-map"]) :where([class*="number"], [class*="index"], [class*="no"], [class*="order"]) {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  color: #ff6b3d !important;
}

/* Final home lesson boxes: every lesson gets its own framed card. */
html body.is-student-home #lessonGrid.adventure-map {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 22px !important;
  padding: 28px !important;
  overflow: visible !important;
}

html body.is-student-home #lessonGrid.adventure-map .adventure-node,
html body.is-student-home #lessonGrid.adventure-map .adventure-node:nth-child(n) {
  position: relative !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-rows: 64px minmax(132px, 1fr) auto auto !important;
  min-height: 294px !important;
  gap: 10px !important;
  align-items: center !important;
  justify-items: center !important;
  overflow: visible !important;
  padding: 16px 16px 18px !important;
  border: 2px solid rgba(205, 161, 75, 0.42) !important;
  border-radius: 8px !important;
  background:
    linear-gradient(180deg, rgba(255, 254, 242, 0.94), rgba(255, 249, 221, 0.92)),
    #fff7d8 !important;
  box-shadow: 0 16px 34px -28px rgba(93, 75, 37, 0.42) !important;
  transform: none !important;
}

html body.is-student-home #lessonGrid.adventure-map .adventure-node:hover {
  border-color: rgba(255, 122, 68, 0.68) !important;
  background:
    linear-gradient(180deg, rgba(255, 253, 232, 0.98), rgba(255, 243, 202, 0.96)),
    #fff2c7 !important;
  transform: translateY(-2px) !important;
}

html body.is-student-home #lessonGrid.adventure-map .adventure-node.is-current {
  border-color: rgba(255, 112, 58, 0.9) !important;
  box-shadow:
    0 20px 40px -28px rgba(255, 107, 61, 0.62),
    inset 0 0 0 4px rgba(255, 236, 171, 0.75) !important;
}

html body.is-student-home #lessonGrid.adventure-map .adventure-node__number {
  grid-column: 1 !important;
  grid-row: 1 !important;
  justify-self: start !important;
  align-self: start !important;
  color: #ff6840 !important;
  font-family: Georgia, "Times New Roman", serif !important;
  font-size: clamp(58px, 5vw, 78px) !important;
  font-weight: 900 !important;
  line-height: 0.88 !important;
  text-shadow: 0 3px 0 rgba(255, 225, 150, 0.9) !important;
}

html body.is-student-home #lessonGrid.adventure-map .adventure-node__art {
  grid-column: 1 !important;
  grid-row: 2 !important;
  position: relative !important;
  display: grid !important;
  place-items: center !important;
  width: min(86%, 190px) !important;
  height: 138px !important;
  max-width: 100% !important;
  overflow: visible !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  transform: none !important;
}

html body.is-student-home #lessonGrid.adventure-map .adventure-node__art-frame,
html body.is-student-home #lessonGrid.adventure-map .adventure-node__art .illustration-image-frame,
html body.is-student-home #lessonGrid.adventure-map .adventure-node__art .illustration-image,
html body.is-student-home #lessonGrid.adventure-map .adventure-node__art img:not(.adventure-node__dog),
html body.is-student-home #lessonGrid.adventure-map .adventure-node__art svg {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  overflow: visible !important;
  object-fit: contain !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

html body.is-student-home #lessonGrid.adventure-map .adventure-node__content {
  grid-column: 1 !important;
  grid-row: 3 !important;
  width: 100% !important;
  min-width: 0 !important;
  display: grid !important;
  justify-items: center !important;
  gap: 4px !important;
  padding: 0 !important;
  margin: 0 !important;
  text-align: center !important;
}

html body.is-student-home #lessonGrid.adventure-map .adventure-node__title,
html body.is-student-home #lessonGrid.adventure-map .adventure-node strong {
  color: #0f2d49 !important;
  font-size: clamp(25px, 2vw, 32px) !important;
  line-height: 1.18 !important;
  word-break: keep-all !important;
  overflow-wrap: break-word !important;
  text-align: center !important;
}

html body.is-student-home #lessonGrid.adventure-map .adventure-node__status {
  grid-column: 1 !important;
  grid-row: 4 !important;
  justify-self: center !important;
  min-height: 38px !important;
  padding: 8px 18px !important;
  border-radius: 999px !important;
  background: #14375d !important;
  color: #ffffff !important;
  font-size: 19px !important;
  font-weight: 900 !important;
  line-height: 1.1 !important;
  letter-spacing: 0 !important;
}

html body.is-student-home #lessonGrid.adventure-map .adventure-node__dog {
  position: absolute !important;
  left: 4px !important;
  right: auto !important;
  top: auto !important;
  bottom: 2px !important;
  width: 54px !important;
  height: 54px !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: contain !important;
  transform: none !important;
  z-index: 4 !important;
  filter: drop-shadow(0 8px 10px rgba(50, 56, 73, 0.22)) !important;
}

html body.is-student-home #lessonGrid.adventure-map .adventure-node__complete {
  right: 10px !important;
  top: 10px !important;
  z-index: 5 !important;
}

@media (max-width: 900px) {
  html body.is-student-home #lessonGrid.adventure-map {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 16px !important;
    padding: 18px !important;
  }

  html body.is-student-home #lessonGrid.adventure-map .adventure-node,
  html body.is-student-home #lessonGrid.adventure-map .adventure-node:nth-child(n) {
    min-height: 246px !important;
    grid-template-rows: 52px minmax(106px, 1fr) auto auto !important;
    padding: 14px 12px 16px !important;
  }

  html body.is-student-home #lessonGrid.adventure-map .adventure-node__art {
    width: min(86%, 150px) !important;
    height: 108px !important;
  }

  html body.is-student-home #lessonGrid.adventure-map .adventure-node__status {
    min-height: 34px !important;
    font-size: 17px !important;
  }
}

@media (max-width: 560px) {
  html body.is-student-home #lessonGrid.adventure-map {
    grid-template-columns: 1fr !important;
  }
}

/* Softer cards for young children: framed, rounded, and text-safe. */
html body.is-student-home #lessonGrid.adventure-map {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 24px !important;
  padding: 30px !important;
}

html body.is-student-home #lessonGrid.adventure-map .adventure-node,
html body.is-student-home #lessonGrid.adventure-map .adventure-node:nth-child(n) {
  grid-template-rows: 58px minmax(126px, 1fr) minmax(58px, auto) auto !important;
  min-height: 292px !important;
  gap: 9px !important;
  padding: 17px 18px 18px !important;
  overflow: hidden !important;
  border: 2px solid rgba(222, 174, 90, 0.48) !important;
  border-radius: 30px 24px 34px 22px !important;
  background:
    linear-gradient(180deg, rgba(255, 254, 244, 0.98), rgba(255, 248, 224, 0.96)),
    #fff7dc !important;
  box-shadow:
    0 18px 34px -30px rgba(92, 72, 34, 0.55),
    inset 0 0 0 4px rgba(255, 255, 255, 0.55) !important;
}

html body.is-student-home #lessonGrid.adventure-map .adventure-node:nth-child(4n + 2) {
  border-radius: 24px 32px 23px 35px !important;
}

html body.is-student-home #lessonGrid.adventure-map .adventure-node:nth-child(4n + 3) {
  border-radius: 34px 23px 31px 25px !important;
}

html body.is-student-home #lessonGrid.adventure-map .adventure-node:nth-child(4n) {
  border-radius: 26px 35px 24px 31px !important;
}

html body.is-student-home #lessonGrid.adventure-map .adventure-node:hover,
html body.is-student-home #lessonGrid.adventure-map .adventure-node.is-current {
  border-color: rgba(255, 123, 72, 0.76) !important;
  background:
    linear-gradient(180deg, rgba(255, 254, 236, 0.99), rgba(255, 242, 205, 0.98)),
    #fff0c6 !important;
}

html body.is-student-home #lessonGrid.adventure-map .adventure-node__number {
  font-size: clamp(54px, 4.7vw, 72px) !important;
  line-height: 0.88 !important;
}

html body.is-student-home #lessonGrid.adventure-map .adventure-node__art {
  width: min(84%, 172px) !important;
  height: 122px !important;
  overflow: visible !important;
}

html body.is-student-home #lessonGrid.adventure-map .adventure-node__art-frame,
html body.is-student-home #lessonGrid.adventure-map .adventure-node__art .illustration-image-frame,
html body.is-student-home #lessonGrid.adventure-map .adventure-node__art .illustration-image,
html body.is-student-home #lessonGrid.adventure-map .adventure-node__art img:not(.adventure-node__dog),
html body.is-student-home #lessonGrid.adventure-map .adventure-node__art svg {
  object-fit: contain !important;
  overflow: visible !important;
}

html body.is-student-home #lessonGrid.adventure-map .adventure-node__content {
  min-height: 58px !important;
  align-content: center !important;
  overflow: hidden !important;
}

html body.is-student-home #lessonGrid.adventure-map .adventure-node__title,
html body.is-student-home #lessonGrid.adventure-map .adventure-node strong {
  display: -webkit-box !important;
  width: 100% !important;
  max-width: 100% !important;
  overflow: hidden !important;
  -webkit-box-orient: vertical !important;
  -webkit-line-clamp: 3 !important;
  white-space: normal !important;
  word-break: normal !important;
  overflow-wrap: anywhere !important;
  text-wrap: balance !important;
  color: #0f2d49 !important;
  font-size: clamp(20px, 1.55vw, 27px) !important;
  line-height: 1.16 !important;
  text-align: center !important;
}

html body.is-student-home #lessonGrid.adventure-map .adventure-node__status {
  min-height: 42px !important;
  padding: 10px 22px !important;
  font-size: 21px !important;
  box-shadow: 0 13px 20px -16px rgba(20, 55, 93, 0.62) !important;
}

html body.is-student-home #lessonGrid.adventure-map .adventure-node__dog {
  left: 12px !important;
  bottom: 12px !important;
  width: 56px !important;
  height: 56px !important;
}

@media (max-width: 900px) {
  html body.is-student-home #lessonGrid.adventure-map {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 18px !important;
    padding: 20px !important;
  }

  html body.is-student-home #lessonGrid.adventure-map .adventure-node,
  html body.is-student-home #lessonGrid.adventure-map .adventure-node:nth-child(n) {
    min-height: 250px !important;
    grid-template-rows: 50px minmax(104px, 1fr) minmax(50px, auto) auto !important;
  }

  html body.is-student-home #lessonGrid.adventure-map .adventure-node__title,
  html body.is-student-home #lessonGrid.adventure-map .adventure-node strong {
    font-size: clamp(19px, 5vw, 25px) !important;
  }
}

@media (max-width: 560px) {
  html body.is-student-home #lessonGrid.adventure-map {
    grid-template-columns: 1fr !important;
  }
}
