/* Story Garden v1.172 — responsive progress consolidation
   Keeps the established visual design while moving Reading Journey, streak,
   and garden-friend progress into the garden panel. */

/* The removed progress strip leaves one intentional breathing gap between the
   primary navigation and the reading workspace. */
.sn-main-stage-v3,
.pp-main-stage.sn-main-stage-v3 {
  margin-top: clamp(10px, 1vw, 14px) !important;
}

/* Total-read count now lives with the existing bookshelf navigation icon. */
.sn-icon-only-navigation #bookshelfButton.sn-bookshelf-count-button {
  width: auto !important;
  min-width: 72px !important;
  gap: 5px !important;
  padding: 0 11px !important;
  border: 1px solid rgba(92, 151, 226, .22) !important;
  background: linear-gradient(180deg, rgba(249, 252, 255, .92), rgba(226, 240, 255, .82)) !important;
  color: #1b5da8 !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 5px 12px rgba(48, 106, 171, .09) !important;
}

.sn-icon-only-navigation #bookshelfButton.sn-bookshelf-count-button:hover,
.sn-icon-only-navigation #bookshelfButton.sn-bookshelf-count-button:focus-visible {
  border-color: rgba(45, 122, 216, .48) !important;
  background: linear-gradient(180deg, #f7fbff, #d8ebff) !important;
  color: #0f56aa !important;
}

.sn-bookshelf-count-button .sn-nav-icon {
  font-size: 1.22rem;
}

.sn-nav-book-total {
  min-width: 1.15em;
  display: inline-grid;
  place-items: center;
  color: currentColor;
  line-height: 1;
}

.sn-nav-book-count {
  color: currentColor;
  font-family: "Nunito", sans-serif;
  font-size: .92rem;
  font-weight: 900;
  line-height: 1;
  text-align: center;
}

/* Journey progress replaces the former three-step quest strip. */
#storyQuestCard.sn-story-quest-card {
  display: flex !important;
  flex-direction: column !important;
  justify-content: flex-start !important;
  align-content: stretch !important;
  gap: 8px !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

.sn-garden-journey {
  flex: 0 0 auto;
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 3px;
  padding: 8px 10px 7px;
  border: 1px solid rgba(104, 151, 111, .24);
  border-radius: 17px;
  background: linear-gradient(180deg, rgba(255,255,255,.86), rgba(248,253,245,.76));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 6px 16px rgba(58, 91, 64, .07);
}

.sn-garden-journey-heading {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sn-garden-journey .sn-journey-title {
  min-width: 0;
  gap: 6px;
  color: #315b42;
  font-size: .82rem;
  line-height: 1.1;
}

.sn-garden-journey .sn-journey-title > span {
  font-size: 1rem;
}

.sn-garden-journey .sn-journey-count {
  flex: 0 0 auto;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(238, 247, 232, .94);
  color: #41644c;
  font-size: .64rem;
  line-height: 1;
}

.sn-garden-journey .sn-bookshelf-fill {
  width: calc(100% - 8px) !important;
  height: 28px !important;
  min-height: 28px !important;
}

.sn-garden-journey-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 0;
  padding-top: 3px;
  border-top: 1px solid rgba(105, 145, 111, .16);
}

.sn-garden-journey-stat {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 4px 6px 2px;
  color: #315b42;
}

.sn-garden-journey-stat + .sn-garden-journey-stat {
  border-left: 1px solid rgba(105, 145, 111, .18);
}

.sn-garden-journey-stat-icon {
  flex: 0 0 auto;
  font-size: 1.2rem;
  line-height: 1;
  filter: drop-shadow(0 2px 3px rgba(61, 80, 65, .14));
}

.sn-garden-journey-stat-copy {
  min-width: 0;
  display: grid;
  gap: 1px;
  line-height: 1;
}

.sn-garden-journey-stat-copy strong {
  color: #264e38;
  font-size: .88rem;
  font-weight: 950;
  line-height: 1;
}

.sn-garden-journey-stat-copy > span {
  color: #607969;
  font-size: .55rem;
  font-weight: 850;
  line-height: 1.08;
  white-space: nowrap;
}

/* The meadow remains the dominant visual and fills the rest of the garden
   card, so its lower edge tracks the bottom of the story text panel. */
#storyQuestCard .sn-story-garden-progress {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  align-self: stretch !important;
}

.sn-right-column > .sn-practice-card-v3 {
  justify-content: flex-start !important;
}

@media (min-width: 1025px) {
  .sn-right-column > .sn-practice-card-v3 {
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  #storyQuestCard.sn-story-quest-card {
    flex: 1 1 auto !important;
    height: auto !important;
  }
}

/* Short laptops keep the same information hierarchy without shrinking the
   story text or rebuilding the existing garden artwork. */
@media (min-width: 1025px) and (max-height: 760px) {
  .sn-garden-journey {
    gap: 1px;
    padding: 5px 8px 4px;
    border-radius: 14px;
  }

  .sn-garden-journey .sn-journey-title {
    font-size: .72rem;
  }

  .sn-garden-journey .sn-journey-title > span {
    font-size: .88rem;
  }

  .sn-garden-journey .sn-journey-count {
    padding: 2px 6px;
    font-size: .56rem;
  }

  .sn-garden-journey .sn-bookshelf-fill {
    height: 23px !important;
    min-height: 23px !important;
  }

  .sn-garden-journey-stat {
    gap: 5px;
    padding: 2px 4px 1px;
  }

  .sn-garden-journey-stat-icon {
    font-size: 1rem;
  }

  .sn-garden-journey-stat-copy strong {
    font-size: .76rem;
  }

  .sn-garden-journey-stat-copy > span {
    font-size: .49rem;
  }
}

@media (max-width: 900px) {
  .sn-icon-only-navigation #bookshelfButton.sn-bookshelf-count-button {
    width: 100% !important;
    min-width: 0 !important;
    padding-inline: 8px !important;
  }
}

@media (max-width: 520px) {
  .sn-icon-only-navigation #bookshelfButton.sn-bookshelf-count-button {
    gap: 2px !important;
    padding-inline: 4px !important;
  }

  .sn-nav-book-count {
    font-size: .78rem;
  }

  .sn-garden-journey {
    padding: 8px 9px 7px;
  }

  .sn-garden-journey .sn-journey-title {
    font-size: .76rem;
  }

  .sn-garden-journey-stat {
    gap: 5px;
    padding-inline: 3px;
  }

  .sn-garden-journey-stat-copy > span {
    font-size: .51rem;
  }
}

html[data-sn-theme="dark"] .sn-icon-only-navigation #bookshelfButton.sn-bookshelf-count-button {
  border-color: rgba(91, 145, 205, .42) !important;
  background: linear-gradient(180deg, #243d5b, #1c324d) !important;
  color: #b9dcff !important;
}

html[data-sn-theme="dark"] .sn-garden-journey {
  border-color: rgba(126, 180, 134, .25);
  background: linear-gradient(180deg, rgba(30, 58, 54, .88), rgba(20, 45, 42, .82));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 6px 16px rgba(0,0,0,.14);
}

html[data-sn-theme="dark"] .sn-garden-journey .sn-journey-title,
html[data-sn-theme="dark"] .sn-garden-journey-stat,
html[data-sn-theme="dark"] .sn-garden-journey-stat-copy strong {
  color: #e3f2e6;
}

html[data-sn-theme="dark"] .sn-garden-journey .sn-journey-count {
  background: rgba(103, 156, 111, .18);
  color: #d4e8d8;
}

html[data-sn-theme="dark"] .sn-garden-journey-metrics,
html[data-sn-theme="dark"] .sn-garden-journey-stat + .sn-garden-journey-stat {
  border-color: rgba(143, 190, 149, .18);
}

html[data-sn-theme="dark"] .sn-garden-journey-stat-copy > span {
  color: #b6cfbd;
}


/* =========================================================
   v1.172 — dynamic garden sections
   Both inner panels now share the available height instead of depending on
   fixed artwork heights. The Journey section grows modestly; the Meadow takes
   the larger share. On mobile, both return to content-driven sizing.
   ========================================================= */
@media (min-width: 901px) {
  #storyQuestCard.sn-story-quest-card {
    display: grid !important;
    flex: 1 1 auto !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-areas: "journey" "garden" "garden" !important;
    grid-template-rows: minmax(96px, .30fr) minmax(150px, .70fr) minmax(0, 1fr) !important;
    align-content: stretch !important;
    justify-content: stretch !important;
    height: 100% !important;
    min-height: 0 !important;
    align-self: stretch !important;
  }

  .sn-garden-journey {
    grid-area: journey;
    height: 100%;
    min-height: 0;
    grid-template-rows: auto minmax(28px, 1fr) auto;
    align-content: stretch;
  }

  .sn-garden-journey .sn-bookshelf-fill {
    align-self: center;
  }

  #storyQuestCard .sn-story-garden-progress {
    flex: none !important;
    align-self: stretch !important;
    height: 100% !important;
    min-height: 0 !important;
    grid-template-rows: auto minmax(0, 1fr) auto auto auto !important;
  }

  #storyQuestCard .sn-story-growth {
    align-self: stretch !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
  }
}

/* Let metric copy determine the required height instead of clipping or
   forcing the whole Journey panel to a fixed label height. */
.sn-garden-journey-stat-copy > span {
  white-space: normal;
  text-wrap: balance;
}

.sn-garden-journey-stat,
.sn-garden-journey-metrics,
#storyQuestCard .sn-story-garden-meta,
#storyQuestCard .sn-story-garden-next-reward {
  min-height: 0;
}

@media (min-width: 1025px) and (max-height: 760px) {
  #storyQuestCard.sn-story-quest-card {
    grid-template-rows: minmax(78px, .34fr) minmax(108px, .66fr) minmax(0, 1fr) !important;
  }

  .sn-garden-journey {
    grid-template-rows: auto minmax(22px, 1fr) auto;
  }
}

@media (max-width: 900px) {
  #storyQuestCard.sn-story-quest-card {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-areas: "journey" "garden" !important;
    grid-template-rows: auto auto !important;
    height: auto !important;
    overflow: visible !important;
  }

  .sn-garden-journey {
    height: auto;
    min-height: max-content;
    grid-template-rows: auto auto auto;
  }

  #storyQuestCard .sn-story-garden-progress {
    height: auto !important;
    min-height: clamp(240px, 76vw, 390px) !important;
    grid-template-rows: auto minmax(clamp(132px, 46vw, 248px), 1fr) auto auto auto !important;
  }

  #storyQuestCard .sn-story-growth {
    height: 100% !important;
    min-height: clamp(132px, 46vw, 248px) !important;
  }
}

@media (max-width: 430px) {
  .sn-garden-journey-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sn-garden-journey-stat {
    padding-inline: 3px;
  }

  #storyQuestCard .sn-story-garden-progress {
    min-height: clamp(228px, 82vw, 340px) !important;
  }
}

/* =========================================================
   v1.173 — portrait tablet full-width garden stack
   The legacy tablet Practice layout used two columns for microphone/actions.
   After those controls were removed, it auto-placed the Garden title in the
   empty left column and the Journey/Meadow panels in the right column.
   Keep this redesigned card as one full-width, content-driven stack.
   ========================================================= */
@media (orientation: portrait) and (min-width: 700px) and (max-width: 1100px) {
  .sn-right-column > .sn-practice-card-v3 {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    grid-template-columns: none !important;
    grid-template-rows: none !important;
    grid-template-areas: none !important;
    column-gap: 0 !important;
    row-gap: 8px !important;
  }

  .sn-right-column > .sn-practice-card-v3 > .sn-tools-title,
  .sn-right-column > .sn-practice-card-v3 > .sn-practice-notices,
  .sn-right-column > .sn-practice-card-v3 > #storyQuestCard {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    align-self: stretch !important;
    justify-self: stretch !important;
    grid-column: 1 / -1 !important;
  }

  .sn-right-column > .sn-practice-card-v3 > .sn-tools-title {
    order: 0;
  }

  .sn-right-column > .sn-practice-card-v3 > .sn-practice-notices {
    order: 1;
  }

  .sn-right-column > .sn-practice-card-v3 > #storyQuestCard {
    order: 2;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-areas: "journey" "garden" !important;
    grid-template-rows: auto auto !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  .sn-right-column > .sn-practice-card-v3 .sn-garden-journey {
    width: 100% !important;
    height: auto !important;
    min-height: max-content !important;
  }

}

/* =========================================================
   v1.175 — iPad navigation-to-content breathing room
   Add a modest gap below the primary navigation before the story and
   Reading Buddy/Garden columns begin. This changes only tablet-sized
   viewports and does not alter card dimensions or internal navigation padding.
   ========================================================= */
@media (min-width: 700px) and (max-width: 1100px) {
  .sn-main-stage-v3,
  .pp-main-stage.sn-main-stage-v3 {
    margin-top: 16px !important;
  }
}

/* v1.176: custom Story Garden grow icon for the garden tile heading */
.sn-tools-title > .sn-tools-title-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: block;
  object-fit: contain;
  image-rendering: auto;
  filter: drop-shadow(0 2px 4px rgba(103, 72, 26, 0.16));
}

@media (max-width: 640px) {
  .sn-tools-title > .sn-tools-title-icon {
    width: 32px;
    height: 32px;
  }
}


/* v1.183: Garden Journal achievement metric replaces Garden Friends. */
.sn-garden-journal-stat {
  appearance: none;
  width: 100%;
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
  border-radius: 10px;
  transition: background-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.sn-garden-journal-stat:hover {
  background: rgba(255, 255, 255, 0.5);
}

.sn-garden-journal-stat:active {
  transform: scale(0.98);
}

.sn-garden-journal-stat:focus-visible {
  outline: 3px solid rgba(111, 75, 194, 0.34);
  outline-offset: 1px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.82);
}

html[data-sn-theme="dark"] .sn-garden-journal-stat:hover,
html[data-sn-theme="dark"] .sn-garden-journal-stat:focus-visible {
  background: rgba(255, 255, 255, 0.08);
}

/* =========================================================
   v1.190 — replace every visible seedling emoji with the
   branded Story Garden grow icon at a context-appropriate size.
   ========================================================= */
img.sn-grow-icon {
  display: block;
  flex: 0 0 auto;
  max-width: 100%;
  object-fit: contain;
  object-position: center;
  image-rendering: auto;
  user-select: none;
  -webkit-user-drag: none;
}

.sn-grow-icon--title {
  width: 34px;
  height: 34px;
}

.sn-update-banner-icon > .sn-grow-icon--update {
  width: 32px;
  height: 35px;
}

.sn-bookshelf-fill > .sn-vine-bloom > .sn-grow-icon--journey {
  width: 24px;
  height: 26px;
  filter: drop-shadow(0 3px 3px rgba(72, 96, 44, .22));
}

#storyQuestCard .sn-story-quest-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.sn-grow-icon--status {
  width: 18px;
  height: 20px;
}

#storyQuestCard .sn-story-garden-milestone > .sn-grow-icon--milestone {
  width: 78%;
  height: 84%;
}

#storyQuestCard .sn-story-garden-patch-flower > .sn-grow-icon--garden-flower,
.sn-story-garden-scene-flower > .sn-grow-icon--garden-flower {
  width: 76%;
  height: 82%;
}

.sn-story-garden-featured-scene .sn-story-garden-scene-flower > .sn-grow-icon--garden-flower {
  width: 74%;
  height: 80%;
}

.sn-story-garden-collection-scene > span > .sn-grow-icon--collection {
  width: clamp(34px, 62%, 48px);
  height: auto;
  margin: 0 auto;
  filter: drop-shadow(0 4px 6px rgba(56, 87, 45, .22));
}

.sn-celebration-buddy-badge > .sn-grow-icon--celebration {
  width: 27px;
  height: 30px;
}

.sn-share-story-mark > .sn-grow-icon--share {
  width: 42px;
  height: 46px;
}

.sn-badge-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.sn-badge-chip > .sn-grow-icon--badge {
  width: 19px;
  height: 21px;
}

.sn-badge-chip.is-locked > .sn-grow-icon--badge {
  filter: grayscale(1);
  opacity: .55;
}

.sn-journal-item-emoji > .sn-grow-icon--journal-story {
  width: 30px;
  height: 33px;
  margin: 0 auto;
}

.sn-scene-particle > .sn-grow-icon--particle {
  width: 1.35em;
  height: 1.47em;
  filter: drop-shadow(0 2px 2px rgba(56, 87, 45, .18));
}

.sn-scene-actor > .sn-grow-icon--scene-actor {
  width: clamp(54px, 8vw, 92px);
  height: auto;
  margin: 0 auto;
  filter: drop-shadow(0 8px 10px rgba(40, 75, 44, .22));
}

@media (max-width: 640px) {
  .sn-grow-icon--title {
    width: 32px;
    height: 32px;
  }

  .sn-bookshelf-fill > .sn-vine-bloom > .sn-grow-icon--journey {
    width: 21px;
    height: 23px;
  }

  .sn-grow-icon--status {
    width: 17px;
    height: 19px;
  }

  .sn-share-story-mark > .sn-grow-icon--share {
    width: 38px;
    height: 42px;
  }
}

.sn-bookshelf-scene > .sn-grow-icon--catalog-story {
  width: 25px;
  height: 27px;
  margin: 0 auto;
}

.sn-favorite-scene > .sn-grow-icon--catalog-story {
  width: 39px;
  height: 43px;
  margin: 0 auto;
}

.sn-history-story-icon {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  vertical-align: middle;
}

.sn-history-story-icon > .sn-grow-icon--history-story {
  width: 23px;
  height: 25px;
}

.sn-history-detail-header h2,
.sn-history-session-card-topline strong {
  display: flex;
  align-items: center;
  gap: 7px;
}

.sn-history-detail-header h2 .sn-grow-icon--history-story {
  width: 31px;
  height: 34px;
}

.sn-history-session-card-topline strong > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
