/* Likebei H5 V19: Lili V2, direct level entry, and forgiving classification */
.tree-fruit {
  width: clamp(15px, 2.4vw, 25px);
  height: clamp(15px, 2.4vw, 25px);
  border-radius: 52% 48% 55% 45%;
  background:
    radial-gradient(circle at 34% 27%, #ffd19a 0 8%, transparent 9%),
    radial-gradient(circle at 38% 32%, #c96131 0 26%, #813315 57%, #4f1d0e 100%);
  border: 1px solid #5b260f;
  font-size: 0 !important;
  box-shadow: inset -3px -4px 6px #3b130a66, 0 3px 5px #35190855;
}

.tree-fruit::before {
  content: '';
  position: absolute;
  width: 42%;
  height: 24%;
  left: 29%;
  top: -16%;
  border-radius: 60% 60% 35% 35%;
  background: linear-gradient(#d8ae64, #8d642c);
  transform: rotate(-5deg);
}

.memory-comic {
  margin: 14px 0 20px;
  overflow: hidden;
  border: 1px solid #d9ccb6;
  border-radius: 20px;
  background: #f7efdf;
  box-shadow: 0 8px 22px #17384a12;
}

.memory-comic img {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  background: #f7efdf;
}

.memory-comic figcaption {
  padding: 10px 14px 12px;
  color: #6e5a35;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  border-top: 1px solid #e5d8c3;
}

.classify-board {
  display: grid;
  gap: 22px;
}

.class-pool {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #f4eee2;
}

.classify-head,
.category-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.classify-head b,
.category-head b {
  font-size: 16px;
}

.classify-head small,
.category-head small {
  color: var(--muted);
  font-size: 11px;
}

.classify-cards,
.category-items {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 56px;
  margin-top: 14px;
}

.classify-cards button,
.category-items button {
  border: 1px solid #d3c6b1;
  border-radius: 13px;
  background: #fff;
  color: var(--ink);
  padding: 12px 16px;
  line-height: 1.5;
  cursor: grab;
  box-shadow: 0 4px 0 #17384a0d;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.classify-cards button:hover,
.classify-cards button.picked {
  border-color: var(--green);
  color: var(--green2);
  transform: translateY(-2px);
  box-shadow: 0 5px 0 #28896526;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.category-drop {
  min-height: 190px;
  padding: 20px;
  border: 2px dashed #c5b79d;
  border-radius: 22px;
  background: #fffaf0;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}

.category-drop:hover,
.category-drop.ready {
  border-color: #6aae89;
  background: #eef7f1;
}

.category-drop.ready:hover {
  transform: translateY(-2px);
}

.category-items button {
  cursor: pointer;
}

.category-items:empty::after {
  content: '拖到分类框任意位置即可';
  color: #9a907f;
  font-size: 11px;
  align-self: center;
}

.feed-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  padding: 20px;
  background: #17384a99;
  backdrop-filter: blur(5px);
  pointer-events: none;
  animation: feedOverlay 3.4s ease both;
}

.feed-overlay > b {
  color: #17384a;
  background: #fffaf0f2;
  border-radius: 999px;
  padding: 10px 18px;
  box-shadow: 0 8px 24px #102c3a33;
}

.feed-sprite {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: min(78vw, 410px);
  aspect-ratio: 1;
  border: 8px solid #fffaf0;
  border-radius: 30px;
  background-color: #fff9ec;
  background-image: url('/assets/lili-feed-1-wait.png');
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
  box-shadow: 0 20px 60px #102c3a66;
  animation: feedFrames 2.7s steps(1, end) both, feedCardIn .22s ease-out both;
}

.feed-sprite::before {
  content: '';
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 52%;
  width: 58px;
  aspect-ratio: 1;
  background: url('/assets/chestnut-fruit-v24.png') center / contain no-repeat;
  filter: drop-shadow(0 7px 8px #59310d40);
  animation: feedChestnutFly 2.35s ease-in-out both;
}

.feed-sprite::after {
  content: '♥  ✦  ♥';
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 12%;
  color: #d78b37;
  font-size: clamp(22px, 5vw, 36px);
  letter-spacing: 8px;
  text-shadow: 0 4px 12px #fff7df;
  white-space: nowrap;
  animation: feedJoy 2.35s ease .4s both;
}

@keyframes feedFrames {
  0%, 13% { background-image: url('/assets/lili-feed-1-wait.png'); }
  14%, 25% { background-image: url('/assets/lili-feed-2-catch.png'); }
  26%, 34% { background-image: url('/assets/lili-feed-3-hug.png'); }
  35%, 47% { background-image: url('/assets/lili-feed-4-nibble.png'); }
  48%, 56% { background-image: url('/assets/lili-feed-3-hug.png'); }
  57%, 72% { background-image: url('/assets/lili-feed-4-nibble.png'); }
  73%, 79% { background-image: url('/assets/lili-feed-3-hug.png'); }
  80%, 100% { background-image: url('/assets/lili-feed-5-celebrate.png'); }
}

@keyframes feedChestnutFly {
  0% { opacity: 0; transform: translate(-230px, -150px) rotate(-38deg) scale(.65); }
  8% { opacity: 1; }
  25% { opacity: 1; transform: translate(-50%, -50%) rotate(12deg) scale(1); }
  31%, 100% { opacity: 0; transform: translate(-50%, -50%) rotate(12deg) scale(.75); }
}

@keyframes feedJoy {
  0%, 73% { opacity: 0; transform: translate(-50%, 18px) scale(.7); }
  78% { opacity: 1; transform: translate(-50%, 0) scale(1.08); }
  88% { opacity: 1; transform: translate(-50%, -8px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -24px) scale(.92); }
}

@keyframes feedCardIn {
  from { opacity: 0; transform: translateY(18px) scale(.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes feedOverlay {
  0% { opacity: 0; }
  4.4%, 94% { opacity: 1; }
  100% { opacity: 0; }
}

@media (width <= 560px) {
  .memory-comic {
    margin: 10px 0 16px;
    border-radius: 16px;
  }

  .memory-comic img {
    max-height: 390px;
  }

  .class-pool,
  .category-drop {
    padding: 16px;
  }

  .classify-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .category-grid {
    grid-template-columns: 1fr;
  }

  .category-drop {
    min-height: 142px;
  }

  .classify-cards button,
  .category-items button {
    width: 100%;
    text-align: left;
    padding: 13px 14px;
  }

  .feed-sprite {
    width: min(88vw, 370px);
    border-radius: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .feed-sprite {
    background-image: url('/assets/lili-feed-5-celebrate.png');
    animation: none;
  }

  .feed-overlay {
    animation: none;
  }

  .feed-sprite::before,
  .feed-sprite::after {
    display: none;
  }
}


/* V23 continuous challenge loop */
.resume-card {
  width: min(760px, calc(100% - 32px));
  margin: 22px auto 30px;
  padding: 18px 22px;
  display: grid;
  gap: 4px;
  text-align: left;
  color: #17384a;
  border: 1px solid #b7d9ca;
  border-radius: 20px;
  background: linear-gradient(135deg, #f0faf4, #fffaf0);
  box-shadow: 0 10px 26px #17384a12;
  cursor: pointer;
}

.resume-card:hover { transform: translateY(-2px); box-shadow: 0 14px 30px #17384a1c; }
.resume-card small { color: #278568; font-weight: 800; letter-spacing: .06em; }
.resume-card b { font-size: clamp(18px, 2vw, 23px); }
.resume-card span { color: #67777c; }
.feed-countdown { white-space: nowrap; color: #176d57; font-weight: 800; }

.result-actions { max-width: 620px; }

.next-reward {
  margin: 2px auto 18px;
  padding: 10px 16px;
  width: fit-content;
  border-radius: 999px;
  color: #8a611c;
  background: #fff2c8;
  font-weight: 800;
}

.result-actions .continue-main {
  width: min(100%, 600px);
  min-height: 58px;
  font-size: clamp(17px, 2vw, 21px);
  box-shadow: 0 10px 0 #b67d20, 0 16px 28px #9d6a2330;
}

.feedback.ok button::after {
  content: ' · 答对后约0.8秒自动前进';
  opacity: .72;
  font-size: .78em;
}

@media (width <= 560px) {
  .resume-card { width: calc(100% - 20px); margin: 14px auto 22px; padding: 15px 17px; border-radius: 17px; }
  .next-reward { max-width: 100%; border-radius: 16px; }
  .feedback.ok button::after { content: ' · 自动前进'; }
  .wallet span.feed-countdown { display: inline-flex; padding-inline: 7px; font-size: 10px; }
}


/* V24 recognizable chestnuts and one-subject full harvest tree */
.tree-fruit {
  width: clamp(16px, 2.15vw, 26px);
  aspect-ratio: 1;
  font-size: 0;
  background: url('/assets/chestnut-fruit-v24.png') center / contain no-repeat;
  filter: drop-shadow(0 3px 3px #35190855);
  z-index: 3;
  animation: none;
  transform: translate(-50%, -50%);
}

.tree-fruit.fruit-1 { width: clamp(15px, 2vw, 24px); }
.tree-fruit.fruit-2 { width: clamp(17px, 2.3vw, 27px); }
.tree-fruit.fruit-3 { width: clamp(15px, 2.05vw, 25px); }
.tree-fruit.newest {
  z-index: 4;
  animation: fruitPop .7s cubic-bezier(.18,1.5,.4,1) both, fruitSwing 3s ease-in-out .8s infinite;
}

.tree-bud.fruit-ready {
  width: clamp(19px, 2.5vw, 30px);
  aspect-ratio: 1;
  font-size: 0 !important;
  background: url('/assets/chestnut-fruit-v24.png') center / contain no-repeat !important;
  filter: drop-shadow(0 3px 3px #35190855);
}

.chestnut-wallet { display: inline-flex; align-items: center; gap: 4px; }
.chestnut-wallet img { width: 21px; height: 21px; object-fit: contain; }
.result-icon img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 8px 10px #6d361d35); }
.level-chestnut { width: 27px; height: 27px; object-fit: contain; display: block; }

.tree-hole-store {
  position: absolute;
  z-index: 5;
  left: 64%;
  top: 75%;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  border-radius: 999px;
  color: #fff8e5;
  background: #5d351fd9;
  box-shadow: 0 5px 12px #25140945;
  font-size: 11px;
  font-weight: 800;
}
.tree-hole-store img { width: 18px; height: 18px; filter: none; animation: none; }

@media (width <= 560px) {
  .tree-fruit { width: 16px; }
  .tree-fruit.fruit-1, .tree-fruit.fruit-3 { width: 15px; }
  .tree-fruit.fruit-2 { width: 17px; }
  .chestnut-wallet img { width: 18px; height: 18px; }
  .tree-hole-store { font-size: 9px; padding: 4px 6px; }
}

/* V25 botanically correct chestnut-burr growth system */
.living-tree > .tree-fruit,
.living-tree > .tree-bud,
.living-tree > .tree-hole-store {
  display: none !important;
}

.burr-growth-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  overflow: visible;
}

.tree-burr-slot {
  --burr-rotate: 0deg;
  position: absolute;
  width: clamp(21px, 2.55vw, 32px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%) rotate(var(--burr-rotate));
  transform-origin: 50% 22%;
  filter: drop-shadow(0 3px 3px #291b0d48);
  opacity: 1;
  transition: opacity .35s ease, transform .55s cubic-bezier(.18, 1.4, .35, 1), filter .35s ease;
  animation: burrGrowIn .62s cubic-bezier(.16, 1.35, .38, 1) both;
  animation-delay: calc(var(--burr-index) * 25ms);
}

.tree-burr-slot::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: 48%;
  top: -9%;
  width: 2px;
  height: 22%;
  border-radius: 999px;
  background: linear-gradient(90deg, #4a351f, #8a6837 52%, #392616);
  transform: rotate(-8deg);
  transform-origin: bottom;
  box-shadow: 1px 0 1px #1e140d44;
}

.tree-burr-slot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.tree-burr-slot.stage-closed {
  width: clamp(17px, 2vw, 25px);
  opacity: .72;
  filter: saturate(.82) brightness(.88) drop-shadow(0 2px 2px #291b0d36);
}

.tree-burr-slot.stage-cracked {
  width: clamp(19px, 2.2vw, 28px);
}

.tree-burr-slot.stage-half {
  width: clamp(21px, 2.4vw, 30px);
}

.tree-burr-slot.stage-mature {
  width: clamp(23px, 2.55vw, 32px);
}

.tree-burr-slot.current-burr {
  opacity: .58;
  animation: burrBreathe 3.2s ease-in-out infinite;
}

.tree-burr-slot.dormant {
  opacity: 0;
  transform: translate(-50%, -50%) rotate(var(--burr-rotate)) scale(.45);
}

.living-tree.compact .tree-burr-slot {
  width: clamp(17px, 2vw, 25px);
}
.living-tree.compact .tree-burr-slot.stage-closed { width: clamp(14px, 1.55vw, 19px); }
.living-tree.compact .tree-burr-slot.stage-cracked { width: clamp(16px, 1.7vw, 21px); }
.living-tree.compact .tree-burr-slot.stage-half { width: clamp(17px, 1.85vw, 23px); }
.living-tree.compact .tree-burr-slot.stage-mature { width: clamp(18px, 2vw, 25px); }

@keyframes burrGrowIn {
  from { opacity: 0; transform: translate(-50%, -50%) rotate(var(--burr-rotate)) scale(.45); }
  to { transform: translate(-50%, -50%) rotate(var(--burr-rotate)) scale(1); }
}

@keyframes burrBreathe {
  0%, 100% { transform: translate(-50%, -50%) rotate(var(--burr-rotate)) scale(.94); }
  50% { transform: translate(-50%, -50%) rotate(var(--burr-rotate)) scale(1.04); }
}

@media (width <= 560px) {
  .tree-burr-slot { width: 24px; }
  .tree-burr-slot.stage-closed { width: 19px; }
  .tree-burr-slot.stage-cracked { width: 21px; }
  .tree-burr-slot.stage-half { width: 23px; }
  .tree-burr-slot.stage-mature { width: 25px; }
  .living-tree.compact .tree-burr-slot.stage-closed { width: 14px; }
  .living-tree.compact .tree-burr-slot.stage-cracked { width: 16px; }
  .living-tree.compact .tree-burr-slot.stage-half { width: 17px; }
  .living-tree.compact .tree-burr-slot.stage-mature { width: 19px; }
}
/* V25.1: reserve a separate footer band for the habitat explanation. */
.habitat-scene {
  box-sizing: border-box;
  min-height: 560px;
  padding-bottom: 108px;
}

.habitat-scene .living-tree {
  height: 410px;
}

.habitat-scene .speech {
  z-index: 8;
  background: rgba(255, 250, 240, 0.97);
  border: 1px solid rgba(226, 215, 197, 0.92);
  box-shadow: 0 8px 22px rgba(23, 56, 74, 0.16);
  line-height: 1.55;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* Production UI: internal content-production notes must never appear to students. */
.chapter-card > .route-note {
  display: none !important;
}

@media (max-width: 560px) {
  .habitat-scene {
    min-height: 480px;
    padding-bottom: 98px;
  }

  .habitat-scene .living-tree {
    height: 340px;
  }

  .habitat-scene .speech {
    left: 14px;
    right: 14px;
    bottom: 14px;
    padding: 13px 15px;
    font-size: 15px;
    line-height: 1.55;
  }
}
