/* WordNap homepage repair, 2026-11-23. Reference: existing product, no new theme.
   One normal-flow layout replaces the height-gated/grid/display:contents mix.
   Intentionally scoped to Home; no storage, account, lesson, or pet data changes. */
#screen-home.active {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "top" "brand" "hero" "info" "actions" "spacer" "icp";
  /* Explicit max-content rows: tracks never shrink to fit the viewport, so extra
     content becomes real scroll overflow instead of being squeezed/clipped. */
  grid-template-rows: repeat(5, max-content) minmax(0, 1fr) max-content;
  grid-auto-rows: max-content;
  align-content: start;
  justify-items: center;
  align-items: start;
  gap: 14px;
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
  padding: calc(16px + var(--safe-top)) 20px 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  text-align: center;
  background: var(--bg-page);
  isolation: isolate;
}
#screen-home .home-top {
  grid-area: top;
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: auto;
  min-height: 44px;
  margin: 0;
  pointer-events: auto;
}
#screen-home .home-top .icon-btn,
#screen-home .home-top .icon-btn:not(.pill) {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  pointer-events: auto;
}
#screen-home .home-top .icon-btn.pill { width: auto; padding: 0 14px; font-size: 1.15385rem; }
#screen-home .home-top .icon-btn img { width: 22px; height: 22px; }
#screen-home .brand-block {
  grid-area: brand;
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  align-self: start;
  justify-self: stretch;
  justify-content: flex-start;
  width: 100%;
  min-width: 0;
  height: auto;
  max-height: none;
  margin: 0;
  padding: 0;
  gap: 0;
  pointer-events: auto;
  overflow: visible;
}
#screen-home .brand-block .brand {
  position: static;
  align-self: auto;
  font-size: clamp(2.15rem, 3.8vw, 3.4rem);
  line-height: 1.15;
  margin: 0;
  pointer-events: none;
}
#screen-home .brand-block .tagline {
  align-self: auto;
  max-width: 42ch;
  font-size: 1.15385rem;
  line-height: 1.5;
  margin: 6px 0 0;
  white-space: normal;
  overflow-wrap: anywhere;
  pointer-events: none;
}
/* The visible rounded surface and its padding ARE the native button hit box.
   No click-through parent; no decorative/transparent children intercept taps. */
#screen-home .brand-block #pack-chip {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  justify-self: center;
  flex: 0 0 auto;
  gap: 10px;
  width: auto;
  max-width: 100%;
  height: auto;
  min-height: 44px;
  box-sizing: border-box;
  margin: 12px 0 0;
  padding: 10px 18px;
  border: 1px solid var(--border-default);
  border-radius: 999px;
  background: var(--bg-surface);
  color: var(--text-primary);
  font: 500 1.15385rem/1.45 var(--font);
  white-space: normal;
  overflow-wrap: anywhere;
  pointer-events: auto;
  touch-action: manipulation;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
}
#screen-home #pack-chip *,
#screen-home #pack-chip::before,
#screen-home #pack-chip::after,
#screen-home .home-top button *,
#screen-home .home-actions button * { pointer-events: none; }
#screen-home .brand-block #pack-chip .chip-caret { flex: 0 0 auto; font-size: 1.4rem; line-height: 1; }
#screen-home .brand-block #pack-chip .chip-badge { font-size: 0.923rem; line-height: 1.4; }

/* Media is bounded by its own button and stacking context, never above the chip. */
#screen-home .hero-tap {
  grid-area: hero;
  position: relative;
  z-index: 1;
  isolation: isolate;
  align-self: center;
  justify-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  flex: none;
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: auto;
  margin: 0;
  padding: 8px 0;
  overflow: hidden;
  border: 0;
  border-radius: 24px;
  background: transparent;
  box-shadow: none;
  color: var(--text-primary);
  touch-action: manipulation;
}
#screen-home .hero-tap * { pointer-events: none; }
#screen-home .hero {
  position: relative;
  z-index: 0;
  flex: none;
  display: block;
  width: min(100%, 24rem, max(7.5rem, calc((100cqh - 480px) * 1.6)));
  height: auto;
  min-height: 0;
  max-height: none;
  aspect-ratio: 8 / 5 !important;
  margin: 0 auto;
  overflow: visible;
}
#screen-home .hero-cushion {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  aspect-ratio: auto;
  margin: 0;
  border: 0;
  border-radius: 0;
  outline: 0;
  box-shadow: none;
  background: transparent;
}
#screen-home .hero-cushion::before {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 23% 0 0;
  width: 100%;
  height: 77%;
  border-radius: 50%;
  background: var(--fill-accent-soft);
  pointer-events: none;
}
#screen-home .hero-cat {
  position: absolute;
  z-index: 1;
  display: block;
  inset: 0 14%;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  aspect-ratio: auto;
  margin: 0;
  transform: none;
  pointer-events: none;
}
/* Explicit absolute inset chain: no unresolved percentage-height flex child. */
#screen-home .hero-cat .hero-drowsy { position: absolute; inset: 0; display: block; width: auto; height: auto; }
#screen-home .hero-cat .hero-drowsy .drowsy-frame { position: absolute; inset: 0; display: block; }
#screen-home #companion-line {
  width: 100%;
  margin: 12px 0 0;
  font-size: 1.23077rem;
  font-weight: 600;
  line-height: 1.5;
  white-space: normal;
  overflow-wrap: anywhere;
}
#screen-home .home-xp { width: min(14rem, 70%); height: 6px; margin: 8px auto 0; }

#screen-home .info-pill {
  grid-area: info;
  position: relative;
  align-self: start;
  width: 100%;
  height: auto;
  min-height: 0;
  margin: 0;
  padding: 8px 0;
  box-sizing: border-box;
  border: 0;
  background: transparent;
}
#screen-home .info-pill .line,
#screen-home #week { display: none; }
#screen-home .home-stats {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 1px minmax(0, 1fr) 1px minmax(0, 1fr);
  align-items: center;
  width: 100%;
  gap: 8px;
}
#screen-home .home-stat { display: flex; flex-direction: column; gap: 4px; min-width: 0; align-items: center; justify-content: center; white-space: normal; text-align: center; }
#screen-home .home-stat b { font-family: var(--font); font-size: 1.84615rem; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
#screen-home .home-stat span { font-size: 1rem; line-height: 1.45; color: var(--text-secondary); overflow-wrap: anywhere; }
#screen-home .home-stat-sep { display: block; width: 1px; height: 32px; background: var(--border-default); }

#screen-home .home-actions {
  grid-area: actions;
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-self: center;
  justify-self: center;
  align-items: stretch;
  width: 100%;
  max-width: 440px;
  min-width: 0;
  margin: 0;
  padding: 0;
  gap: 12px;
  box-shadow: none;
  background: transparent;
}
#screen-home .home-actions > #btn-start {
  position: relative;
  width: 100%;
  max-width: none;
  height: auto;
  min-height: 56px;
  margin: 0;
  padding: 14px 20px;
  border-radius: 999px;
  font-size: 1.46154rem;
  font-weight: 700;
  line-height: 1.45;
  white-space: normal;
  overflow-wrap: anywhere;
  color: #FFFFFF;
  background: #E86B4A;
  touch-action: manipulation;
}
#screen-home #product-home-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  gap: 10px;
}
#screen-home #product-home-controls .btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: auto;
  min-height: 52px;
  margin: 0;
  padding: 12px 10px;
  border-radius: 14px;
  border: 1px solid var(--border-default);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 1.15385rem;
  font-weight: 500;
  line-height: 1.45;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
  touch-action: manipulation;
}
#screen-home #product-home-controls > button:first-child:nth-last-child(3) { grid-column: 1 / -1; }
/* t292u: remove the Home entry only. Keep its hidden node as the existing
   product-controls mount anchor; course content and welcome-path entry stay intact. */
#screen-home .home-actions > #btn-phonics-home { display: none !important; }
#screen-home .home-actions .home-quota:not([hidden]) { position: static; height: auto; margin: 0; font-size: 1rem; line-height: 1.5; overflow-wrap: anywhere; }
#screen-home button:focus-visible { outline: 3px solid var(--text-primary); outline-offset: 3px; }


#screen-home .home-icp-spacer { grid-area: spacer; width: 100%; min-height: 0; pointer-events: none; }
#screen-home .home-icp {
  grid-area: icp;
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: center;
  align-items: center;
  justify-self: center;
  width: 100%;
  margin: 0;
  padding: 8px 12px calc(22px + var(--safe-bottom));
  background: #FFF8EE;
  pointer-events: auto;
}
#screen-home .home-icp a,
#screen-home #home-icp-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: 156px;
  min-height: 32px;
  padding: 8px 12px;
  margin: 0;
  font-family: "PingFang SC", "PingFang SC Regular", "Hiragino Sans GB", "Noto Sans CJK SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 12px;
  font-weight: 400;
  line-height: 14px;
  letter-spacing: 0;
  color: #787060;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  background: transparent;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
#screen-home .home-icp a:focus-visible {
  outline: 3px solid var(--text-primary);
  outline-offset: 2px;
}
/* Break on available width, NOT height. Short desktop windows remain usable.
   #app widens for Home only; other screens retain their current breakpoints. */
@media (min-width: 48rem) {
  #app:has(> #screen-home.active) { max-width: none; }
  #screen-home.active {
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
    grid-template-areas: "top top" "brand actions" "hero actions" "info actions" "spacer spacer" "icp icp";
    grid-template-rows: repeat(4, max-content) minmax(0, 1fr) max-content;
    column-gap: clamp(24px, 4vw, 64px);
    row-gap: 14px;
    padding: calc(16px + var(--safe-top)) max(32px, calc((100% - 1120px) / 2)) 0;
  }
  #screen-home .brand-block .tagline { font-size: 1.23077rem; }
  #screen-home .hero { width: min(100%, 40rem, max(8rem, calc((100cqh - 300px) * 1.6))); }
  /* Explicit absolute inset chain: no unresolved percentage-height flex child. */
#screen-home .hero-cat .hero-drowsy { position: absolute; inset: 0; display: block; width: auto; height: auto; }
#screen-home .hero-cat .hero-drowsy .drowsy-frame { position: absolute; inset: 0; display: block; }
#screen-home #companion-line { font-size: 1.38462rem; }
  #screen-home .home-actions { max-width: 400px; padding: 12px 0; }
  #screen-home .info-pill { padding-top: 0; }
}
@media (min-width: 48rem) and (max-height: 650px) {
  #screen-home.active { row-gap: 10px; padding-top: calc(12px + var(--safe-top)); padding-bottom: 0; }
  #screen-home .hero { width: min(100%, 27rem, max(8rem, calc((100cqh - 340px) * 1.6))); }
  #screen-home .brand-block .brand { font-size: 2.46154rem; }
}
@media (max-width: 280px) {
  #screen-home.active { padding-left: 16px; padding-right: 16px; }
  #screen-home #product-home-controls { grid-template-columns: minmax(0, 1fr); }
}

/* Real mini-cards (not one-line secondary buttons): local WordNap surface pattern. */
#screen-home #product-home-controls .home-review-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "icon count" "title title" "note note";
  justify-items: start;
  align-items: start;
  align-content: start;
  min-height: 128px;
  padding: 14px;
  gap: 8px 10px;
  border-radius: 18px;
  text-align: left;
}
#screen-home .home-review-icon { grid-area: icon; display: grid; place-items: center; width: 32px; height: 32px; color: var(--text-primary); }
#screen-home .home-review-icon svg { display: block; width: 24px; height: 24px; }
#screen-home .home-review-count { grid-area: count; display: inline-flex; justify-content: center; align-items: center; min-width: 32px; min-height: 32px; padding: 2px 8px; box-sizing: border-box; border-radius: 10px; background: var(--bg-soft); color: var(--text-primary); font-size: 1.38462rem; font-weight: 700; line-height: 1.4; }
#screen-home .home-review-title { grid-area: title; font-size: 1.23077rem; font-weight: 600; line-height: 1.4; color: var(--text-primary); overflow-wrap: anywhere; }
#screen-home .home-review-note { grid-area: note; font-size: 1rem; font-weight: 400; line-height: 1.5; color: var(--text-secondary); overflow-wrap: anywhere; }
