/* badges.css —— 徽章册（badges.js / badgeart.js）：贴纸、攒贴纸的星星、徽章册、奖状、一屏补发
 * 首页的徽章册钮在 home.css（.mx-home__book），全屏庆祝的暗幕和动画在 base.css（.mx-badgewin）。
 */

/* ---------------------------------------------------------------- 贴纸 */

.mx-sticker-host { display: inline-block; width: 100%; height: 100%; line-height: 0; }
.mx-sticker-host svg { display: block; width: 100%; height: 100%; }

/* 攒贴纸的 5 颗小星 */
.mx-pips { display: inline-flex; gap: 1px; line-height: 1; }
.mx-pips i {
  font-style: normal; font-size: 17px; color: #fffdf5;
  -webkit-text-stroke: 1.4px #c9941d; text-shadow: 0 1px 0 rgba(0, 0, 0, .12);
}
.mx-pips i.is-on { color: #ffcf2e; }
.mx-pips.is-done i { color: #ffcf2e; }

/* ---------------------------------------------------------------- 徽章册 */

.mx-book__modal { width: min(100%, 860px); padding: 18px 22px 16px; }
.mx-book { display: flex; flex-direction: column; gap: 12px; }
.mx-book__top { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; font-family: var(--font-display); }
.mx-book__title { margin: 0; font-family: var(--font-display); font-size: 26px; font-weight: 400; color: var(--ink); }
.mx-book__stars { margin-left: auto; }
.mx-book__close {
  flex: none; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--card-stroke); background: var(--paper-2);
  color: var(--ink-soft); font-size: 30px; line-height: 1; padding-bottom: 3px; cursor: pointer;
}
.mx-book__close:active { transform: scale(.94); }
.mx-book__count { font-size: 19px; color: var(--ink-soft); }
.mx-book__count b { font-size: 30px; color: var(--ink); font-weight: 400; }
.mx-book__stars { display: inline-flex; align-items: center; gap: 8px; font-size: 17px; color: var(--ink-soft); }
.mx-book__stars .mx-pips i { font-size: 22px; }
.mx-book__sheet {
  border-radius: 22px; padding: 20px 14px 16px;
  background: radial-gradient(circle at 20% 15%, rgba(255, 255, 255, .14) 0 2px, transparent 3px) 0 0 / 34px 34px, #f0866e;
  box-shadow: inset 0 -6px 0 rgba(170, 70, 50, .35), 0 2px 0 rgba(0, 0, 0, .04);
  overflow: hidden;
}
.mx-book__grid {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px 8px; justify-items: center;
  touch-action: pan-y;
}
.mx-book__grid.is-turn-next { animation: mx-book-next 280ms var(--ease-out, ease-out); }
.mx-book__grid.is-turn-prev { animation: mx-book-prev 280ms var(--ease-out, ease-out); }
@keyframes mx-book-next { from { transform: translateX(48px); opacity: .15; } }
@keyframes mx-book-prev { from { transform: translateX(-48px); opacity: .15; } }

.mx-book__slot {
  /* 4 行要放进一屏：iPad 横屏 820 高减去顶栏、翻页、边距约 330 */
  position: relative; width: min(114px, 15vw, calc((100vh - 330px) / 4)); aspect-ratio: 1; padding: 0; border: 0; background: none; cursor: pointer;
  transition: transform 100ms ease-out; -webkit-tap-highlight-color: transparent;
}
.mx-book__slot:active { transform: scale(.94); }
.mx-book__slot:focus-visible { outline: 3px solid #fff; outline-offset: 2px; border-radius: 50%; }
.mx-book__slot .mx-sticker-host { filter: drop-shadow(0 3px 0 rgba(120, 40, 20, .25)); }
.mx-book__hole {
  position: absolute; inset: 8%; border-radius: 50%; border: 5px solid rgba(255, 255, 255, .72);
  display: grid; place-items: center; color: rgba(255, 255, 255, .92);
  font-family: var(--font-display); font-size: clamp(24px, 3.4vw, 34px);
}
.mx-book__slot.is-limited .mx-book__hole { border-style: dashed; border-color: #ffe7a0; color: #ffe7a0; }
.mx-book__no {
  position: absolute; right: -2px; top: -6px; padding: 0 6px; border-radius: 8px;
  background: #fff; border: 2.5px solid #2b2b33; color: #2b2b33;
  font-family: var(--font-display); font-size: 14px; line-height: 20px;
}
.mx-book__slot.is-empty .mx-book__no { display: none; }
.mx-book__ribbon {
  position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); padding: 1px 8px; border-radius: 999px;
  background: #d8382c; color: #ffe7a0; font-size: 12px; font-weight: 700; letter-spacing: .04em; white-space: nowrap;
}
.mx-book__wearing {
  position: absolute; left: -2px; top: -6px; padding: 0 6px; border-radius: 8px;
  background: #ffe74a; border: 2px solid #c9941d; color: #6b4200;
  font-family: var(--font-display); font-size: 13px; line-height: 19px;
}
.mx-book__pager { display: flex; align-items: center; justify-content: center; gap: 18px; }
.mx-book__turn {
  width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--card-stroke); background: var(--paper-2);
  box-shadow: 0 3px 0 color-mix(in srgb, var(--paper-2), var(--wood-dark) 26%); color: var(--ink);
  font-size: 34px; line-height: 1; padding-bottom: 4px; cursor: pointer;
}
.mx-book__turn:disabled { opacity: .3; cursor: default; }
.mx-book__turn:active:not(:disabled) { transform: translateY(1px) scale(.95); }
.mx-book__pageno { min-width: 72px; text-align: center; font-family: var(--font-display); font-size: 20px; color: var(--ink-soft); }

/* ---------------------------------------------------------------- 奖状 */

.mx-cert__modal { width: min(100%, 560px); }
.mx-cert {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 28px 34px 24px; border-radius: 8px; text-align: center;
  background: #fbf6e6; border: 3px solid #e2b64a; outline: 6px double #e2b64a; outline-offset: -14px;
}
.mx-cert__no { font-family: var(--font-display); font-size: 30px; color: #d9a72a; }
.mx-cert__sticker { width: 172px; height: 172px; filter: drop-shadow(0 4px 0 rgba(120, 80, 10, .18)); }
.mx-cert:not(.is-have) .mx-cert__no { color: #c9b07a; }
.mx-cert__hole {
  width: 136px; height: 136px; margin: 12px 0; border-radius: 50%; border: 6px dashed #e3c79a;
  display: grid; place-items: center; color: #d4a86a; font-family: var(--font-display); font-size: 46px;
}
.mx-cert__name { font-family: var(--font-display); font-size: 30px; color: var(--ink); }
.mx-cert__desc { font-size: 17px; line-height: 1.5; color: var(--ink-soft); }
.mx-cert__fact {
  display: flex; align-items: flex-start; gap: 8px; margin-top: 8px; padding: 10px 12px; border-radius: 12px;
  background: #fff1bd; text-align: left; font-size: 17px; line-height: 1.55; color: #5a4300;
}
.mx-cert__fact-tag {
  flex: none; margin-top: 2px; padding: 0 8px; border-radius: 999px; background: #f2b632; color: #fff;
  font-family: var(--font-display); font-size: 13px; line-height: 21px;
}
.mx-cert__fact-text { flex: 1; font-family: var(--font-kai); }
.mx-cert__speak { flex: none; border: 0; background: none; padding: 0 2px; font-size: 22px; line-height: 1.2; cursor: pointer; }
.mx-cert__prog { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 6px 10px; margin-top: 8px; font-family: var(--font-display); font-size: 19px; color: #c58b00; }
.mx-cert__prog .mx-pips i { font-size: 22px; }
.mx-cert__bar { display: block; width: min(180px, 100%); height: 14px; border-radius: 999px; background: #efe2c2; overflow: hidden; }
.mx-cert__bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #ffd34d, #f2a516); }
.mx-cert__sig { align-self: stretch; display: flex; justify-content: space-between; align-items: flex-end; margin-top: 18px; font-size: 15px; color: #6c6458; }
.mx-cert__kid { font-family: var(--font-kai); font-weight: 400; font-size: 30px; color: var(--ink); border-bottom: 2px solid #e2b64a; padding: 0 24px 2px; }

/* ---------------------------------------------------------------- 全屏庆祝里的贴纸（base.css .mx-badgewin__medal 的贴纸版） */

.mx-badgewin__medal.is-sticker {
  background: none; box-shadow: none; overflow: hidden; border-radius: 50%; color: inherit;
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, .45));
}
.mx-badgewin__medal.is-sticker.is-limited { box-shadow: none; }
.mx-badgewin__medal.is-sticker .mx-badgewin__medal-icon { width: 100%; height: 100%; }
.mx-badgewin__desc.is-fact { max-width: min(560px, 86vw); font-family: var(--font-kai); line-height: 1.5; }

/* 一屏补发（celebrateMany） */
.mx-many__stage { gap: 10px; max-width: min(920px, 94vw); }
.mx-many__lead { font-size: clamp(16px, 2.2vw, 20px); color: #f5e6c4; }
.mx-many__grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 12px 10px;
  width: min(880px, 92vw); max-height: 56vh; overflow: auto; padding: 8px 4px;
}
.mx-many__grid.is-dense { grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); }
.mx-many__cell { display: flex; flex-direction: column; align-items: center; gap: 4px; opacity: 0; transform: scale(.3) rotate(-25deg); }
.mx-many__cell .mx-sticker-host { width: 88px; height: 88px; }
.mx-many__grid.is-dense .mx-many__cell .mx-sticker-host { width: 76px; height: 76px; }
.mx-many__cell.is-on { animation: mx-many-pop 460ms cubic-bezier(.2, 1.5, .4, 1) forwards; }
.mx-many__name { font-family: var(--font-display); font-size: 15px; color: #fff6dc; text-shadow: 0 2px 0 rgba(0, 0, 0, .35); white-space: nowrap; }
@keyframes mx-many-pop { to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- 结算页：星星攒进徽章册 */

.mx-result__starblock { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.mx-result__book {
  display: inline-flex; align-items: center; gap: 8px; padding: 3px 14px; border-radius: 999px;
  background: color-mix(in srgb, var(--gold-2, #ffe08a) 35%, transparent); font-family: var(--font-display); font-size: 16px; color: var(--ink-soft);
  opacity: 0; transform: translateY(6px); transition: opacity 300ms ease, transform 300ms ease;
}
.mx-result__book.is-on { opacity: 1; transform: none; }
.mx-result__book-gain { color: #c58b00; }
.mx-result__badge .mx-result__badge-icon.mx-sticker-host { width: 72px; height: 72px; background: none; box-shadow: none; border-radius: 0; }
.mx-result__badge .mx-result__badge-icon.mx-sticker-host svg { width: 100%; height: 100%; }

@media (prefers-reduced-motion: reduce) {
  .mx-book__grid.is-turn-next, .mx-book__grid.is-turn-prev { animation: none; }
  .mx-many__cell { opacity: 1; transform: none; }
  .mx-many__cell.is-on { animation: none; }
}
