/* ============================================================
   首頁、森林地圖、關卡開場、結算畫面
   ============================================================ */
.screen { animation: screen-in .32s ease-out; }

/* ---------- 首頁 ---------- */
.home-hero {
  position: relative;
  isolation: isolate;
  min-height: 430px;
  padding: clamp(22px, 4vw, 52px);
  border: 2px solid var(--ink);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background:
    radial-gradient(circle at 82% 24%, #f9e6a7 0 9%, transparent 9.5%),
    linear-gradient(160deg, #cfe7b9, #8ac7a0 52%, #5aa681);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
}
.hero-art {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 64% 48%;
}
.hero-shade {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(22, 45, 34, .86) 0%, rgba(22, 45, 34, .66) 38%, rgba(22, 45, 34, .16) 68%, rgba(22, 45, 34, .05) 100%),
    linear-gradient(0deg, rgba(22, 45, 34, .5) 0%, transparent 45%);
}
.hero-copy { width: min(590px, 68%); color: #fffdf4; text-shadow: 0 2px 12px rgba(12, 30, 22, .4); }
.hero-copy .eyebrow { color: #ffe5a0; }
.hero-copy h1 {
  margin: 0 0 .2em;
  font-size: clamp(2.7rem, 7.4vw, 5.2rem);
  letter-spacing: .04em;
  line-height: 1.03;
  color: #fffdf4;
  text-shadow: 0 4px 0 rgba(31, 94, 67, .55), 0 14px 34px rgba(9, 25, 18, .45);
}
.hero-lead { font-size: clamp(.96rem, 1.7vw, 1.12rem); line-height: 1.75; max-width: 36em; color: #f8f4df; }
.hero-lead strong { color: #ffe5a0; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0 14px; }
.hero-actions .btn-ghost { background: rgba(255, 253, 244, .16); color: #fff; border-color: rgba(255, 255, 255, .55); backdrop-filter: blur(4px); }
.hero-actions .btn-ghost:hover { background: rgba(255, 253, 244, .3); }
.home-best { margin: 0; font-size: .86rem; color: #f3ecd2; font-weight: 700; }

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr);
  gap: clamp(14px, 2.4vw, 24px);
  margin-top: clamp(14px, 2.4vw, 24px);
}
.home-card {
  padding: clamp(18px, 2.8vw, 28px);
  background: rgba(255, 253, 244, .92);
  border: 1.5px solid rgba(34, 55, 47, .24);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.home-story { display: flex; flex-direction: column; justify-content: center; gap: 10px; }
.speaker-row { display: flex; align-items: flex-end; gap: 10px; }
.speaker-row-right { justify-content: flex-start; flex-direction: row-reverse; }
.avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 54px;
  height: 54px;
  font-size: 1.7rem;
  border: 2px solid var(--ink);
  border-radius: 50%;
  box-shadow: 0 3px 0 rgba(34, 55, 47, .16);
}
.avatar-didi { background: #f5d9a2; }
.avatar-duoduo { background: #cfe9ef; }
.speech-bubble {
  position: relative;
  flex: 0 1 auto;
  padding: 11px 15px;
  background: #f2f7e6;
  border: 1.5px solid rgba(47, 125, 91, .28);
  border-radius: 16px 16px 16px 4px;
  font-size: .92rem;
  line-height: 1.65;
}
.speaker-row-right .speech-bubble { border-radius: 16px 16px 4px 16px; background: #e9f6f8; border-color: rgba(61, 143, 174, .26); }
.speech-bubble p { margin: 0; }
.home-cta-row { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 10px; }
.home-zones h2 { margin-bottom: 12px; font-size: 1.15rem; }
.zone-preview { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.zone-preview li { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 11px; background: var(--paper-2); border: 1px solid var(--line); font-size: .88rem; font-weight: 700; }
.zone-preview .zp-emoji { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: #fff; font-size: 1rem; }
.zone-preview .zp-name { flex: 1 1 auto; }
.zone-preview .zp-count { color: var(--ink-soft); font-weight: 700; font-size: .76rem; font-variant-numeric: tabular-nums; }
.star-summary { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); font-weight: 800; color: var(--leaf-dark); font-size: .9rem; }
.star-summary .stars { color: #b98317; letter-spacing: .08em; }

/* ---------- 森林地圖 ---------- */
.map-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: clamp(14px, 2.2vw, 22px);
}
.map-head h1 { margin: 0 0 .1em; font-size: clamp(1.8rem, 4.4vw, 3rem); }
.map-head p { margin-bottom: 0; max-width: 46em; }
.map-progress-card {
  display: grid;
  justify-items: center;
  gap: 1px;
  min-width: 150px;
  padding: 10px 18px;
  background: var(--cream);
  border: 1.5px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}
.map-progress-number { font-family: var(--font-round); font-size: 1.5rem; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; }
.map-progress-card .muted { font-size: .73rem; }
.stars-total { color: #9a6c13; font-weight: 800; font-size: .86rem; white-space: nowrap; }
.zone-list { display: grid; gap: clamp(14px, 2.3vw, 22px); }
.zone-block {
  position: relative;
  padding: clamp(14px, 2.3vw, 22px);
  background: rgba(255, 253, 244, .92);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.zone-block::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 7px;
  background: var(--zone-color, var(--leaf));
}
.zone-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.zone-badge {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  font-size: 1.45rem;
  background: var(--zone-color2, var(--moss));
  border: 1.5px solid rgba(34, 55, 47, .26);
  border-radius: 14px;
}
.zone-title-wrap { flex: 1 1 210px; min-width: 0; }
.zone-art { flex: 0 0 auto; width: 86px; height: 58px; object-fit: cover; border: 1.5px solid rgba(34, 55, 47, .22); border-radius: 10px; background: var(--paper-2); }
.zone-title-wrap h2 { margin: 0; font-size: clamp(1.15rem, 2.5vw, 1.5rem); }
.zone-title-wrap p { margin: 2px 0 0; font-size: .82rem; color: var(--ink-soft); }
.zone-progress { flex: 0 0 auto; padding: 4px 10px; background: var(--paper-2); border-radius: 999px; font-size: .78rem; font-weight: 800; white-space: nowrap; }
.level-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.level-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: 132px;
  padding: 12px;
  text-align: left;
  background: var(--paper-2);
  border: 1.5px solid rgba(34, 55, 47, .2);
  border-radius: 14px;
  transition: transform .16s, box-shadow .16s, background .16s;
}
.level-card:hover:not(:disabled) { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(34, 55, 47, .16); background: #fffdf4; }
.level-card:active:not(:disabled) { transform: translateY(0); }
.level-card .lc-top { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 4px; }
.level-card .lc-num { font-family: var(--font-round); font-weight: 900; font-size: .82rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.level-card .lc-emoji { font-size: 1.4rem; line-height: 1; }
.level-card .lc-name { font-weight: 800; font-size: .98rem; line-height: 1.3; }
.level-card .lc-concept { font-size: .73rem; line-height: 1.35; color: var(--ink-soft); }
.level-card .lc-stars { margin-top: auto; color: #bd8a24; font-size: 1rem; letter-spacing: .12em; line-height: 1; }
.level-card .lc-best { font-size: .7rem; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.level-card.is-locked { background: #e7e3d4; color: #766f5e; border-style: dashed; }
.level-card.is-locked .lc-emoji { filter: grayscale(1); opacity: .65; }
.level-card.is-locked .lc-stars { color: #aaa38e; }
.level-card.is-current { border-color: var(--zone-color, var(--leaf)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--zone-color, var(--leaf)) 28%, transparent); }
.level-card.is-current::after {
  content: "從這裡開始";
  position: absolute;
  top: -10px;
  right: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--zone-color, var(--leaf));
  color: #fff;
  font-size: .66rem;
  font-weight: 800;
}
.level-card.is-done { background: #f2f7e6; }
.level-row-note { margin: 10px 0 0; font-size: .78rem; color: var(--ink-soft); }
.map-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-top: 18px; }

/* ---------- 關卡開場 ---------- */
.intro-card {
  width: min(900px, 100%);
  margin: 0 auto;
  padding: clamp(18px, 3.4vw, 34px);
  background: rgba(255, 253, 244, .96);
  border: 2px solid var(--ink);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.intro-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.zone-chip, .level-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 900;
}
.zone-chip { background: var(--moss); color: var(--leaf-dark); }
.level-chip { background: var(--sun-light); color: #74510d; }
.intro-main { display: flex; align-items: center; gap: clamp(12px, 2.4vw, 22px); }
.intro-mascots { display: flex; flex: 0 0 auto; }
.intro-mascots .avatar { width: 66px; height: 66px; font-size: 2rem; }
.intro-mascots .avatar + .avatar { margin-left: -16px; }
.intro-main h1 { margin: 0 0 .22em; font-size: clamp(1.8rem, 4.8vw, 3rem); }
.intro-concept { margin: 0; color: var(--ink-soft); font-size: clamp(.92rem, 1.7vw, 1.02rem); line-height: 1.7; }
.intro-story {
  position: relative;
  margin: 18px 0;
  padding: 16px 18px 16px 22px;
  background: linear-gradient(135deg, #eef6df, #f8f4e4);
  border: 1.5px solid rgba(47, 125, 91, .26);
  border-left: 5px solid var(--leaf);
  border-radius: 12px;
  font-size: .98rem;
  line-height: 1.8;
}
.intro-tips { padding: 14px 16px; background: var(--paper-2); border-radius: 12px; }
.intro-tips h2 { margin: 0 0 6px; font-size: 1rem; color: var(--leaf-dark); }
.intro-tips ul { margin: 0; padding-left: 1.25em; }
.intro-tips li { margin-bottom: 3px; font-size: .9rem; }
.intro-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 14px 0; color: var(--ink-soft); font-size: .84rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.intro-actions { display: flex; flex-wrap: wrap; gap: 9px; }

/* ---------- 結算 ---------- */
.result-card {
  width: min(860px, 100%);
  margin: 0 auto;
  padding: clamp(20px, 3.6vw, 38px);
  text-align: center;
  background:
    radial-gradient(circle at 50% -8%, #fff2bd 0%, rgba(255, 242, 189, 0) 45%),
    rgba(255, 253, 244, .97);
  border: 2px solid var(--ink);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.result-card h1 { margin: 0 0 .2em; font-size: clamp(1.8rem, 4.6vw, 3rem); }
.result-stars { display: flex; justify-content: center; gap: 12px; margin: 10px 0 4px; min-height: 74px; }
.result-star {
  font-size: clamp(3rem, 9vw, 4.8rem);
  line-height: 1;
  color: #d8d0b8;
  text-shadow: 0 4px 0 rgba(34, 55, 47, .12);
  transform: scale(.8);
  animation: star-pop .45s cubic-bezier(.2, 1.5, .4, 1) forwards;
}
.result-star.is-on { color: #f0b94d; text-shadow: 0 4px 0 #a9741c, 0 9px 20px rgba(240, 185, 77, .45); }
.result-star:nth-child(2) { animation-delay: .13s; }
.result-star:nth-child(3) { animation-delay: .26s; }
.result-line { font-size: 1.02rem; color: var(--ink-soft); margin-bottom: 16px; }
.result-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0 auto 16px; }
.result-stats > div { display: grid; gap: 1px; padding: 10px 8px; background: var(--paper-2); border: 1px solid var(--line); border-radius: 12px; }
.result-stats span { font-size: .72rem; color: var(--ink-soft); font-weight: 700; }
.result-stats strong { font-family: var(--font-round); font-size: clamp(1.05rem, 2.7vw, 1.5rem); font-variant-numeric: tabular-nums; }
.result-fact {
  margin: 0 auto 18px;
  padding: 12px 16px;
  background: #e9f5f7;
  border: 1px dashed rgba(61, 143, 174, .45);
  border-radius: 12px;
  color: #235e72;
  font-size: .9rem;
  text-align: left;
}
.result-fact::before { content: "森林小知識　"; font-weight: 900; letter-spacing: .04em; }
.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; }
.unlock-note { margin: 14px 0 0; color: var(--rose); font-weight: 900; }

@media (max-width: 860px) {
  .home-grid { grid-template-columns: 1fr; }
  .hero-copy { width: min(560px, 78%); }
  .level-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .home-hero { min-height: 500px; align-items: flex-end; padding: 20px; }
  .hero-art { object-position: 62% 36%; }
  .hero-shade {
    background:
      linear-gradient(0deg, rgba(20, 43, 32, .93) 0%, rgba(20, 43, 32, .72) 42%, rgba(20, 43, 32, .12) 72%, rgba(20, 43, 32, .04) 100%);
  }
  .hero-copy { width: 100%; }
  .hero-copy h1 { font-size: clamp(2.5rem, 12vw, 3.6rem); }
  .hero-lead { font-size: .92rem; line-height: 1.65; }
  .home-card { padding: 16px; }
  .avatar { width: 44px; height: 44px; font-size: 1.4rem; }
  .speech-bubble { padding: 9px 11px; font-size: .86rem; }
  .map-head { align-items: flex-start; }
  .map-progress-card { width: 100%; grid-auto-flow: column; align-items: center; justify-content: space-between; }
  .zone-head { gap: 8px; }
  .zone-badge { width: 42px; height: 42px; font-size: 1.25rem; }
  .zone-art { width: 64px; height: 44px; }
  .level-card { min-height: 124px; padding: 10px; }
  .level-card .lc-name { font-size: .92rem; }
  .level-card .lc-concept { font-size: .7rem; }
  .intro-main { align-items: flex-start; }
  .intro-mascots { flex-direction: column; }
  .intro-mascots .avatar { width: 52px; height: 52px; font-size: 1.55rem; }
  .intro-mascots .avatar + .avatar { margin-left: 0; margin-top: -10px; }
  .result-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 380px) {
  .hero-copy h1 { font-size: 2.3rem; }
  .home-hero { min-height: 500px; }
  .level-grid { gap: 7px; }
  .level-card { min-height: 118px; }
}
