/* Final alignment pass: readable one-line copy, centered imagery and character targets. */
.centered-home > h3 {
  margin-inline: auto !important;
  font-size: clamp(18px, 3.1vw, 29px) !important;
  line-height: 1.2 !important;
  letter-spacing: 0 !important;
  white-space: nowrap;
}

.module-hero {
  container-type: inline-size;
}
.module-hero h3,
.module-hero p,
.module-hero .module-note {
  max-width: none !important;
  white-space: nowrap;
}
.module-hero h3 {
  font-size: clamp(21px, 3.2cqw, 27px) !important;
}
.module-hero p {
  font-size: clamp(13px, 1.9cqw, 16px) !important;
  line-height: 1.5 !important;
}
.module-hero .module-note {
  font-size: clamp(11px, 1.55cqw, 13px) !important;
}
.module-hero .module-art {
  display: block !important;
  justify-self: center !important;
  align-self: center !important;
  width: 100%;
  height: 100%;
  min-height: 218px;
  overflow: hidden;
  border-radius: 0;
}
.module-hero .module-art img {
  display: block;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  margin: 0 !important;
  object-fit: cover !important;
  object-position: center center !important;
}

/* Each original illustration is wide; this brings its learning subject into the visible centre. */
.module-识字 .module-art img,
.module-拼音 .module-art img,
.module-数学 .module-art img,
.module-字母 .module-art img {
  object-position: center center !important;
}
.module-单词 .module-art img {
  object-position: 75% center !important;
}

.char-grid .char {
  position: relative !important;
  min-height: 246px !important;
  padding: 145px 12px 14px !important;
  justify-content: flex-start !important;
  gap: 7px !important;
}
.char-grid .char:before {
  top: 25px !important;
  left: 50% !important;
  width: 108px !important;
  height: 108px !important;
}
.char-grid .char .big-character {
  position: absolute !important;
  top: 25px !important;
  left: 50% !important;
  z-index: 2 !important;
  display: grid !important;
  width: 108px !important;
  height: 108px !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 4px 0 0 !important;
  transform: translateX(-50%);
  place-items: center !important;
  line-height: 1 !important;
  text-align: center !important;
}

@container (max-width:510px) {
  .module-hero h3,
  .module-hero p,
  .module-hero .module-note {
    white-space: normal;
  }
}
@media (max-width: 760px) {
  .centered-home > h3 {
    font-size: clamp(17px, 6.2cqw, 24px) !important;
  }
  .module-hero .module-art {
    width: calc(100% - 28px) !important;
    min-height: 0 !important;
    aspect-ratio: 1.45/1;
    margin: 0 auto 14px !important;
    border-radius: 15px;
  }
  .module-hero .module-art img {
    width: 100% !important;
    height: 100% !important;
  }
  .char-grid .char {
    min-height: 228px !important;
    padding-top: 130px !important;
  }
  .char-grid .char:before {
    top: 22px !important;
    width: 96px !important;
    height: 96px !important;
  }
  .char-grid .char .big-character {
    top: 22px !important;
    width: 96px !important;
    height: 96px !important;
    font-size: 56px !important;
  }
}

/* Pop-ups must sit above the persistent mobile navigation. */
.modal-backdrop {
  z-index: 100 !important;
  background: rgba(78, 43, 64, 0.48) !important;
}
.modal {
  z-index: 101 !important;
  max-height: calc(100vh - 32px);
  overflow: auto;
}
@media (max-width: 760px) {
  .modal-backdrop {
    padding: 14px !important;
    align-items: center !important;
  }
  .modal {
    width: min(520px, calc(100vw - 28px)) !important;
    max-height: calc(100vh - 28px) !important;
    padding: 30px 16px !important;
    border-radius: 24px !important;
  }
  .modal-x {
    z-index: 2 !important;
  }
}

/* A single Kitty becomes the sidebar mascot; each lesson icon keeps the Kitty centred. */
.brand-kitty-photo {
  display: block !important;
  width: 118px !important;
  height: 118px !important;
  object-fit: contain !important;
  object-position: center center !important;
  padding: 7px !important;
  background: #fff !important;
  margin-left: auto !important;
  margin-right: auto !important;
}
.kitty-nav-icon {
  display: inline-grid !important;
  place-items: center !important;
  padding: 1px !important;
}
.kitty-nav-icon img {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  object-position: center center !important;
}
@media (max-width: 760px) {
  .brand {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
  }
  .brand-kitty-photo {
    width: 74px !important;
    height: 74px !important;
    flex: 0 0 74px !important;
    padding: 5px !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }
  .kitty-nav-icon {
    padding: 1px !important;
  }
}

/* Install affordance for computers and Android; iPhone/iPad use Safari's Share menu. */
.asset-loading {
  min-height: 360px;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  color: #9b607c;
}
.asset-loading span {
  font-size: 42px;
  color: #ec83ad;
  animation: asset-loading-pulse 0.8s ease-in-out infinite alternate;
}
.asset-loading h3 { margin: 10px 0 4px; }
.asset-loading p { margin: 0; color: #b08499; }
@keyframes asset-loading-pulse {
  to { transform: scale(1.16) rotate(12deg); opacity: 0.55; }
}

/* The sidebar owns its vertical scroll on every screen size. This keeps the
   gift and star controls reachable on iPad/Safari, including landscape mode. */
.sidebar {
  height: 100vh !important;
  height: 100dvh !important;
  min-height: 0 !important;
  overflow-x: hidden !important;
  overflow-y: scroll !important;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
  padding-bottom: max(34px, env(safe-area-inset-bottom)) !important;
}
.sidebar > *,
.sidebar nav,
.sidebar .nav-item,
.sidebar .side-gift,
.sidebar .stars-box {
  flex-shrink: 0 !important;
}
.nav-item,
.side-gift,
.stars-box,
.lesson-card,
.study-card,
.tab,
.pager button,
.primary-btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.sidebar .tiny {
  margin-top: 10px !important;
  padding-bottom: 10px;
}
.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #e9a9c5;
}

.update-notice {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 30;
  width: min(620px, calc(100% - 28px));
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 11px;
  padding: 13px 15px;
  border: 2px solid #ef9fbe;
  border-radius: 20px;
  background: #fffafd;
  color: #7a4962;
  box-shadow: 0 14px 38px #78445942;
}
.update-notice[hidden] { display: none !important; }
.update-notice > span { font-size: 27px; }
.update-notice b,.update-notice small { display: block; }
.update-notice small { margin-top: 2px; color: #a67c90; font-size: 12px; }
.update-notice button {
  border: 0;
  border-radius: 12px;
  padding: 9px 13px;
  background: #e978a7;
  color: white;
  font: inherit;
  cursor: pointer;
}
.update-notice .update-later { background: #f6e7ee; color: #8e6077; }
.learning-report { text-align: left; }
.learning-report > h3 { text-align: center; }
.learning-report > p { color: #8d6c7c; line-height: 1.65; }
.learning-report h4 { margin: 18px 0 8px; color: #8c5871; }
.report-badge { display: table; margin: 0 auto 8px; padding: 5px 10px; border-radius: 999px; background: #e2f7ec; color: #3e8868; font-size: 12px; }
.report-rows { display: grid; gap: 6px; }
.report-rows > div { display: flex; justify-content: space-between; gap: 14px; padding: 8px 10px; border-radius: 10px; background: #fff2f7; }
.report-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 18px 0; }
.report-cards > div { padding: 10px; border-radius: 12px; background: #f5f0ff; text-align: center; }
.report-cards span,.report-cards b { display: block; }
.report-cards span { min-height: 32px; color: #806d89; font-size: 11px; }
.report-cards b { margin-top: 5px; font-size: 23px; }
@media (max-width: 620px) {
  .update-notice { grid-template-columns: auto minmax(0,1fr); }
  .update-notice button { grid-row: 2; }
  .update-notice #applyUpdate { grid-column: 1 / 2; }
  .update-notice #laterUpdate { grid-column: 2 / 3; }
}

.install-app {
  border: 1px solid #ec9ab9;
  border-radius: 999px;
  padding: 7px 11px;
  background: #fff3f8;
  color: #bd5f8b;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 3px 9px #d6729b22;
}
.install-app:hover {
  background: #ffe3ef;
}
@media (max-width: 760px) {
  .install-app {
    padding: 5px 7px;
    font-size: 10px;
  }
}
/* 阅读故事：图文与拼音保持清晰、居中且适合各尺寸屏幕。 */
.story-panel {
  max-width: 920px;
  margin-inline: auto;
}
.story-hero {
  display: grid;
  grid-template-columns: 1fr minmax(300px, 1.25fr);
  align-items: center;
  gap: clamp(20px, 4vw, 44px);
  padding: clamp(24px, 4vw, 48px);
  border-radius: 32px;
  background: linear-gradient(135deg, #fbf1fb, #f2f5ff);
}
.story-copy h3 {
  margin: 12px 0 10px;
  font-size: clamp(34px, 5vw, 54px);
  color: #c84e8c;
}
.story-copy p {
  margin: 0;
  color: #78566b;
  font-size: clamp(16px, 2vw, 20px);
  line-height: 1.75;
}
.story-art {
  overflow: hidden;
  border-radius: 24px;
  box-shadow: 0 18px 36px rgba(123, 89, 144, 0.16);
}
.story-art img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 8;
  object-fit: cover;
  object-position: center;
}
.story-book {
  max-width: 760px;
  margin: 26px auto 0;
  padding: clamp(26px, 5vw, 54px);
  border: 1px solid #f1d7e7;
  border-radius: 28px;
  background: #fffdfd;
  box-shadow: 0 14px 36px rgba(167, 95, 136, 0.09);
}
.story-book-head {
  display: grid;
  align-items: center;
  justify-items: center;
  gap: 12px;
  margin-bottom: 28px;
  text-align: center;
}
.story-book-head span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 13px;
  border-radius: 999px;
  background: #ffe6f1;
  color: #c85d91;
  font-weight: 800;
  white-space: nowrap;
}
.story-book-head b {
  display: block;
  color: #6e3d5c;
  font-size: clamp(22px, 3vw, 30px);
  white-space: nowrap;
}
.story-book p {
  margin: 0 0 22px;
  color: #60465a;
  font-size: clamp(18px, 2.45vw, 24px);
  font-weight: 650;
  line-height: 2.05;
  text-align: left;
}
.story-book ruby {
  ruby-position: over;
}
.story-book rt {
  color: #df75a6;
  font-size: 0.48em;
  font-weight: 800;
  letter-spacing: 0;
}
.story-read {
  display: block;
  width: min(100%, 310px);
  margin: 32px auto 0;
}
@media (max-width: 700px) {
  .story-hero {
    grid-template-columns: 1fr;
    padding: 22px;
  }
  .story-copy {
    text-align: center;
  }
  .story-art {
    max-width: 620px;
    width: 100%;
    margin: 0 auto;
  }
  .story-book {
    margin-top: 18px;
    border-radius: 22px;
  }
  .story-book p {
    text-align: justify;
  }
}

/* 家长星星编辑：查看保持儿童友好，编辑入口单独加锁。 */
.parent-star-zone {
  margin-top: 20px;
  padding: 16px;
  border-radius: 18px;
  background: #fff5fa;
  text-align: center;
}
.parent-star-zone p {
  margin: 0 0 10px;
  color: #9b7588;
  font-size: 13px;
}
.parent-star-zone button,
.parent-star-quick button {
  border: 1px solid #eba9c6;
  border-radius: 13px;
  background: #fff;
  color: #b85f88;
  padding: 10px 15px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
.parent-star-editor > span {
  display: inline-block;
  padding: 6px 11px;
  border-radius: 999px;
  background: #ffe2ef;
  color: #bc5f89;
  font-weight: 900;
}
.parent-star-editor h3 {
  margin: 14px 0 5px;
  color: #713e5d;
}
.parent-star-editor > p {
  margin: 0 0 20px;
  color: #9b7588;
}
.parent-star-editor label {
  display: grid;
  gap: 7px;
  margin: 13px 0;
  text-align: left;
  color: #72445f;
  font-weight: 800;
}
.parent-star-editor input {
  width: 100%;
  border: 2px solid #f0c9da;
  border-radius: 14px;
  background: #fff;
  padding: 12px 14px;
  color: #6d3e59;
  font: inherit;
}
.parent-star-quick {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 16px 0;
}
.parent-star-quick button {
  padding: 9px 5px;
  background: #fff7fb;
}

/* 幼儿数字数独。 */
.math-mode-tabs {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 20px auto;
}
.math-mode-tabs button {
  border: 2px solid #efd0df;
  border-radius: 999px;
  background: #fff;
  padding: 10px 18px;
  color: #85556d;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}
.math-mode-tabs button.active {
  border-color: #e77eae;
  background: #ffe1ef;
  color: #be4f83;
  box-shadow: 0 6px 14px #d56f9d22;
}
.sudoku-game {
  max-width: 660px;
  margin: 0 auto;
  text-align: center;
}
.sudoku-board {
  display: grid;
  grid-template-columns: repeat(var(--sudoku-size), minmax(54px, 92px));
  justify-content: center;
  width: max-content;
  max-width: 100%;
  margin: 22px auto;
  border: 4px solid #b85b8a;
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
}
.sudoku-cell {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 1px solid #edbdd2;
  background: #fff;
  color: #684459;
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 900;
}
button.sudoku-cell {
  font: inherit;
  font-size: clamp(28px, 5vw, 42px);
  color: #d56f9d;
  cursor: pointer;
}
.sudoku-cell:nth-child(2n) {
  border-right: 3px solid #cf7da3;
}
.sudoku-cell:nth-child(4n) {
  border-right: 0;
}
.sudoku-cell:nth-child(n + 5):nth-child(-n + 8) {
  border-bottom: 3px solid #cf7da3;
}
.sudoku-cell.blank {
  background: #fff5fa;
}
.sudoku-cell.wrong {
  background: #ffe0e0;
  animation: sudoku-shake 0.25s;
}
.sudoku-picker {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}
.sudoku-picker button {
  width: 58px;
  height: 58px;
  border: 2px solid #efc4d8;
  border-radius: 16px;
  background: #fff;
  font-size: 28px;
  cursor: pointer;
}
.sudoku-picker button.selected {
  border-color: #d95491;
  background: #ffe3f0;
  transform: translateY(-2px);
}
.sudoku-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 18px 0;
}
.sudoku-actions button {
  border: 0;
  border-radius: 15px;
  padding: 11px 20px;
  background: #e77eae;
  color: #fff;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}
.sudoku-actions button + button {
  background: #f7e5ee;
  color: #8b6074;
}
.sudoku-game .math-nav {
  align-items: center;
}
.sudoku-game .math-nav span {
  color: #977084;
  font-weight: 900;
}
@keyframes sudoku-shake {
  25% {
    transform: translateX(-3px);
  }
  75% {
    transform: translateX(3px);
  }
}

/* 古诗通俗动画讲解。 */
.poem-video {
  max-width: 650px;
  margin: 28px auto 0;
  padding-top: 26px;
  border-top: 1px solid #f0d7e2;
}
.poem-video-stage {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  background: #2f2030;
  box-shadow: 0 14px 30px #75465c25;
}
.poem-video-stage > img {
  display: block;
  width: 100%;
  height: 270px;
  object-fit: cover;
  object-position: center;
  filter: saturate(0.95);
}
.poem-video-stage:after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 42%, rgba(34, 20, 31, 0.8));
}
.poem-video-play {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 42%;
  display: grid;
  width: 66px;
  height: 66px;
  place-items: center;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #ffffffdf;
  color: #d45f96;
  font-size: 25px;
  box-shadow: 0 8px 25px #2f203055;
}
.poem-video-caption {
  position: absolute;
  z-index: 2;
  left: 20px;
  right: 20px;
  bottom: 18px;
  color: #fff;
  text-align: left;
}
.poem-video-caption b,
.poem-video-caption small {
  display: block;
}
.poem-video-caption b {
  font-size: 20px;
}
.poem-video-caption small {
  margin-top: 5px;
  font-size: 14px;
  line-height: 1.55;
}
.poem-video-button {
  margin: 14px auto 0;
  border: 0;
  border-radius: 999px;
  padding: 12px 20px;
  background: #7b5971;
  color: #fff;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}
.poem-video-stage.playing > img {
  animation: poem-pan 9s ease-in-out both;
}
.poem-video-stage.playing .poem-video-play {
  animation: poem-pulse 1.5s ease-in-out infinite;
}
@keyframes poem-pan {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.12) translateX(-1.5%);
  }
}
@keyframes poem-pulse {
  50% {
    transform: translate(-50%, -50%) scale(1.1);
    opacity: 0.65;
  }
}
@media (max-width: 700px) {
  .math-mode-tabs button {
    padding: 8px 11px;
    font-size: 12px;
  }
  .sudoku-board {
    grid-template-columns: repeat(var(--sudoku-size), minmax(46px, 70px));
  }
  .sudoku-picker button {
    width: 50px;
    height: 50px;
    font-size: 24px;
  }
  .poem-video-stage > img {
    height: 210px;
  }
  .poem-video-caption {
    left: 14px;
    right: 14px;
    bottom: 12px;
  }
  .poem-video-caption b {
    font-size: 17px;
  }
  .poem-video-caption small {
    font-size: 12px;
  }
  .parent-star-quick {
    gap: 5px;
  }
}
.offline-script-warning {
  position: fixed;
  inset: 18px;
  z-index: 99999;
  display: grid;
  place-content: center;
  gap: 12px;
  padding: 28px;
  border: 3px solid #ed8cb5;
  border-radius: 24px;
  background: #fff7fb;
  color: #6e3857;
  text-align: center;
  font-size: 18px;
}

.offline-script-warning b { font-size: 24px; color: #d9558e; }
