/* 墨墨小屋 · 基础样式：reset、排版、通用组件类（DESIGN.md §1.3 / §1.4 / §4.3 ui）
 * 依赖 tokens.css。类名统一 mx- 前缀；场景私有样式放各自的 scenes/*.css。
 * 层级：bg(0) < .mx-scene < 墨墨层 < fx 画布 < .mx-modal < .mx-toast-host
 */

/* ---------- reset ---------- */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: transparent;                 /* 背景由 bg.js 的 .mx-bg 负责 */
  color: var(--ink);
  font: 16px/1.5 var(--font-body);         /* 正文下限 16px */
  overscroll-behavior: none;
  touch-action: manipulation;              /* 去掉双击缩放，Pencil 书写不受影响 */
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-appearance: none; appearance: none; background: none; border: 0; padding: 0; cursor: pointer; }
img, svg, canvas { display: block; max-width: 100%; }
svg { fill: none; }
[hidden] { display: none !important; }

/* ---------- 排版工具类 ---------- */

.mx-display { font-family: var(--font-display); font-weight: 400; }
.mx-brush   { font-family: var(--font-brush); font-weight: 400; }
.mx-kai     { font-family: var(--font-kai); }
.mx-num     { font-family: var(--font-display); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
/* 快乐体的「0」是一个倾斜的空心框，单独出现像缺字方块：数值为 0 时（ui.setNumber 加 is-zero）换成正文字体的椭圆 0。
   只换字体不改字号：苹方粗体的 0 与快乐体数字等高；这里若写 font-size，(0,2,0) 的特异性会压过各组件的单类字号，
   「已驯服 0」「连续 0 天」就会缩成一小粒 */
.mx-num.is-zero { font-family: var(--font-body); font-weight: 700; }
.mx-pinyin  { font-family: var(--font-body); letter-spacing: .04em; color: var(--ink-soft); }
.mx-muted   { color: var(--ink-soft); }
.mx-title   { font-family: var(--font-display); font-size: 28px; line-height: 1.25; color: var(--ink); }
.mx-subtitle{ font-family: var(--font-display); font-size: 20px; line-height: 1.3; color: var(--ink); }
.mx-sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- 场景骨架 ----------
 * .mx-scene 铺满视口，head/foot 固定，body 是唯一可滚动区域；四边留安全区。
 */

.mx-scene {
  position: fixed;
  inset: 0;
  z-index: var(--z-scene);
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px)
           env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
  overflow: hidden;
}

.mx-scene__head { flex: 0 0 auto; padding: 12px 16px 0; }
.mx-scene__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 12px 16px;
}
.mx-scene__foot { flex: 0 0 auto; padding: 0 16px 12px; }

/* 场景进出（main.js 切场景时加类） */
.mx-scene--in  { animation: mx-scene-in var(--dur-card) var(--ease-out) both; }
.mx-scene--out { animation: mx-scene-out var(--dur-exit) var(--ease-in) both; pointer-events: none; }

/* ---------- 卡片：纸面 + 噪点 + 描边 + 柔和阴影 ---------- */

.mx-card {
  position: relative;
  background-color: var(--paper);
  background-image: var(--paper-noise);
  border: 1px solid var(--card-stroke);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px 24px;
}
.mx-card--paper2 { background-color: var(--paper-2); }
.mx-card--translucent {                          /* 默写场景盖在背景中间的半透明纸面 */
  background-color: color-mix(in srgb, var(--paper) 86%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.mx-card--tight { padding: 12px 16px; border-radius: var(--radius); }

/* ---------- 玻璃条（HUD） ---------- */

.mx-glass {
  /* 88% 纸色：夜晚压在深蓝天上仍是暖纸色（≈rgb(232,229,222)），15px 的副标题也能过 AA */
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.25);
  backdrop-filter: blur(16px) saturate(1.25);
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: var(--radius-lg);
  box-shadow: 0 6px 20px rgba(60, 50, 30, .10), inset 0 1px 0 rgba(255, 255, 255, .65);
}

/* ---------- 按钮：软糖质感（2px 更深的底边），按下 scale(.96) + 阴影变浅 ---------- */

.mx-btn {
  --btn-bg: var(--paper-2);
  --btn-fg: var(--ink);
  --btn-edge: color-mix(in srgb, var(--paper-2), var(--wood-dark) 24%);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;                     /* 触控目标 ≥ 44px */
  padding: 10px 22px;
  border-radius: var(--radius);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-display);
  font-size: 18px;                      /* 按钮下限 18px */
  line-height: 1.2;
  white-space: nowrap;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  box-shadow: 0 2px 0 var(--btn-edge), 0 8px 18px rgba(60, 50, 30, .12);
  transition: transform 100ms var(--ease-out), box-shadow 100ms var(--ease-out), filter 100ms;
}
.mx-btn:active:not(:disabled), .mx-btn.is-pressed:not(:disabled) {
  transform: translateY(1px) scale(.96);
  box-shadow: 0 1px 0 var(--btn-edge), 0 3px 8px rgba(60, 50, 30, .08);
}
.mx-btn:focus-visible { outline: 3px solid var(--sky-accent); outline-offset: 3px; }
.mx-btn:disabled {
  cursor: not-allowed;
  filter: saturate(.15) brightness(1.02);
  opacity: .6;
  box-shadow: 0 2px 0 rgba(60, 50, 30, .12);
}
.mx-btn__icon { display: inline-flex; flex: 0 0 auto; width: 1.25em; height: 1.25em; }
.mx-btn__icon svg { width: 100%; height: 100%; }
.mx-btn__label { display: inline-block; }

.mx-btn--primary {
  --btn-bg: var(--coral-deep);              /* 白字压纯珊瑚只有 2.99:1，深一档到 3.44 */
  --btn-fg: #fff;
  --btn-edge: color-mix(in srgb, var(--coral), var(--ink) 26%);
  text-shadow: 0 1px 0 rgba(0, 0, 0, .08);
}
.mx-btn--secondary { /* 默认值就是次按钮 */ }
.mx-btn--ghost {
  --btn-bg: color-mix(in srgb, var(--paper) 70%, transparent);   /* 落在屋顶 / 夜色上也留一层薄纸垫底 */
  --btn-fg: var(--ink-soft);
  box-shadow: none;
}
.mx-btn--ghost:active:not(:disabled), .mx-btn--ghost.is-pressed:not(:disabled) {
  background: rgba(120, 90, 50, .10);
  box-shadow: none;
}
.mx-btn--ghost:disabled { box-shadow: none; }
.mx-btn--icon {                          /* 圆形图标按钮，只有图标，label 作为 aria-label */
  width: 48px;
  min-width: 48px;
  padding: 0;
  border-radius: 50%;
}
.mx-btn--icon .mx-btn__icon { width: 24px; height: 24px; }
.mx-btn--icon.mx-btn--sm { width: 40px; min-width: 40px; min-height: 40px; }
.mx-btn--icon.mx-btn--lg { width: 60px; min-width: 60px; min-height: 60px; }
.mx-btn--icon.mx-btn--lg .mx-btn__icon { width: 30px; height: 30px; }

.mx-btn--sm { min-height: 40px; padding: 6px 16px; font-size: 18px; border-radius: 14px; }
.mx-btn--lg { min-height: 64px; padding: 14px 34px; font-size: 24px; border-radius: var(--radius-lg); gap: 10px; }
.mx-btn--lg .mx-btn__icon { width: 1.15em; height: 1.15em; }
.mx-btn--block { display: flex; width: 100%; }

/* ---------- HUD：玻璃条内的信息布局 ---------- */

.mx-hud {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 6px 10px;
  border-radius: 999px;
}
.mx-hud__left, .mx-hud__right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mx-hud__left { flex: 1 1 auto; }
.mx-hud__center { flex: 0 1 auto; display: flex; align-items: center; justify-content: center; min-width: 0; }
.mx-hud__right { flex: 0 0 auto; margin-left: auto; }
.mx-hud__titles { display: flex; flex-direction: column; min-width: 0; padding-left: 6px; }
.mx-hud__title {
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.15;
  color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mx-hud__subtitle {
  font-family: var(--font-display);
  font-size: 15px;
  line-height: 1.2;
  color: color-mix(in srgb, var(--wisteria) 40%, var(--ink));   /* ≈#585271：纸上 ≈7:1、夜晚玻璃上 ≈6:1（快乐体笔画细，留足余量） */
  text-shadow: 0 1px 0 rgba(255, 255, 255, .45);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mx-hud__stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 4px 14px 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .5);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .6);
}
.mx-hud__stat svg { width: 26px; height: 26px; }
.mx-hud__value { font-size: 22px; line-height: 1; color: var(--ink); }
.mx-hud__unit  { font-family: var(--font-display); font-size: 15px; color: var(--ink-soft); margin-left: -2px; }
.mx-hud__coins .mx-hud__value { color: var(--gold-text); }
.mx-hud__streak .mx-hud__value { color: var(--coral-text); }
.mx-hud__stamina { gap: 2px; padding: 4px 10px; }
.mx-hud__lantern { width: 26px; height: 30px; transition: transform var(--dur-micro) var(--ease-bounce); }
.mx-hud__lantern svg { width: 100%; height: 100%; }
.mx-hud__lantern .lantern-body { fill: var(--coral); stroke: color-mix(in srgb, var(--coral), var(--ink) 20%); transition: fill var(--dur-micro), stroke var(--dur-micro); }
.mx-hud__lantern .lantern-shine { fill: rgba(255, 255, 255, .55); }
.mx-hud__lantern .lantern-cap, .mx-hud__lantern .lantern-tassel { transition: opacity var(--dur-micro); }
/* 空灯笼：只剩细线框，盖与穗子一起变淡 */
.mx-hud__lantern.is-empty .lantern-body { fill: none; stroke: color-mix(in srgb, var(--coral) 55%, transparent); stroke-width: 1.4; }
.mx-hud__lantern.is-empty .lantern-shine { fill: none; }
.mx-hud__lantern.is-empty .lantern-cap, .mx-hud__lantern.is-empty .lantern-tassel { opacity: .35; }
.mx-hud__lantern.mx-anim-pop { animation-duration: 360ms; }

/* 窄屏（竖屏 iPad / 手机）：右侧统计换行，标题缩小 */
@media (max-width: 720px) {
  .mx-hud { flex-wrap: wrap; border-radius: var(--radius-lg); row-gap: 6px; }
  .mx-hud__right { flex: 1 1 100%; justify-content: flex-end; margin-left: 0; }
  .mx-hud__title { font-size: 20px; }
}

/* ---------- 弹窗：遮罩 + 纸面卡片进出 ---------- */

.mx-modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: grid;
  place-items: center;
  padding: calc(24px + env(safe-area-inset-top, 0px)) calc(24px + env(safe-area-inset-right, 0px))
           calc(24px + env(safe-area-inset-bottom, 0px)) calc(24px + env(safe-area-inset-left, 0px));
  background: rgba(43, 43, 51, .36);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: mx-fade-in var(--dur-card) var(--ease-out) both;
}
.mx-modal.is-closing { animation: mx-fade-out var(--dur-exit) var(--ease-in) both; pointer-events: none; }
.mx-modal__card {
  width: min(100%, 520px);
  max-height: 100%;
  overflow: auto;
  padding: 26px 28px 24px;
  animation: mx-modal-in var(--dur-card) var(--ease-out) both;
}
.mx-modal.is-closing .mx-modal__card { animation: mx-modal-out var(--dur-exit) var(--ease-in) both; }
.mx-modal__card:focus { outline: none; }   /* 打开时程序聚焦到卡片，不画焦点环；按钮自己有 focus-visible */
.mx-modal__title { font-family: var(--font-display); font-size: 26px; line-height: 1.25; color: var(--ink); margin-bottom: 12px; }
.mx-modal__body { font-size: 18px; line-height: 1.6; color: var(--ink); }
.mx-modal__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 22px;
}
.mx-modal__actions .mx-btn { flex: 1 1 140px; }

/* ---------- 提示条 ---------- */

.mx-toast-host {
  --mx-toast-bottom: 28px;             /* 场景可按自己的底部布局抬高（main.js 把当前场景写在 body[data-scene]） */
  position: fixed;
  left: 50%;
  bottom: calc(var(--mx-toast-bottom) + env(safe-area-inset-bottom, 0px));
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
}
.mx-toast {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: min(92vw, 560px);
  padding: 12px 22px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 90%, transparent);
  color: var(--paper);
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1.3;
  box-shadow: 0 10px 30px rgba(43, 43, 51, .25);
  animation: mx-toast-in var(--dur-card) var(--ease-out) both;
}
.mx-toast.is-closing { animation: mx-toast-out var(--dur-exit) var(--ease-in) both; }
/* 首页底部是三颗大按钮 + 主按钮下的副标题药丸（离底约 60px）：toast 抬到它们上方，不盖住「N 只在外面 · 消耗 1 体力」 */
body[data-scene="home"] .mx-toast-host { --mx-toast-bottom: 236px; }
.mx-toast__icon { display: inline-flex; width: 22px; height: 22px; color: var(--gold-2); }
.mx-toast__icon svg { width: 100%; height: 100%; }

/* ---------- 小红点 ---------- */

.mx-has-dot { position: relative; }
.mx-badge-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--coral);
  border: 2px solid var(--paper);
  box-shadow: 0 1px 4px rgba(60, 50, 30, .25);
  animation: mx-breathe 2.4s var(--ease-out) infinite;
  pointer-events: none;
}

/* ---------- 通用动画 ---------- */

.mx-anim-pop      { animation: mx-pop 320ms var(--ease-bounce) both; }
.mx-anim-float-up { animation: mx-float-up 900ms var(--ease-out) both; }
.mx-anim-shake    { animation: mx-shake 300ms ease-in-out both; }
.mx-anim-breathe  { animation: mx-breathe 2.4s var(--ease-out) infinite; }
.mx-anim-fade-in  { animation: mx-fade-in var(--dur-card) var(--ease-out) both; }

@keyframes mx-pop {                       /* 写对：定格后微微弹一下 */
  0%   { transform: scale(1); }
  45%  { transform: scale(1.06); }
  100% { transform: scale(1); }
}
@keyframes mx-float-up {                  /* 「+15」上浮淡出：前 70% 保持实心（读得清），最后 30% 淡出；与 fx.js 的 FloatText 一致 */
  0%   { transform: translateY(0); opacity: 0; }
  10%  { opacity: 1; }
  70%  { opacity: 1; }
  100% { transform: translateY(-44px); opacity: 0; }
}
@keyframes mx-shake {                     /* 写错：左右轻摆 2 次，±6px */
  0%, 100% { transform: translateX(0); }
  20%  { transform: translateX(-6px); }
  40%  { transform: translateX(6px); }
  60%  { transform: translateX(-6px); }
  80%  { transform: translateX(6px); }
}
@keyframes mx-breathe {                   /* 当前格 / 小红点呼吸 */
  0%, 100% { transform: scale(1); opacity: 1; }
  50%  { transform: scale(1.06); opacity: .82; }
}
@keyframes mx-fade-in  { from { opacity: 0; } to { opacity: 1; } }
@keyframes mx-fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes mx-modal-in {
  from { transform: translateY(26px) scale(.96); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes mx-modal-out {
  from { transform: translateY(0) scale(1); opacity: 1; }
  to   { transform: translateY(12px) scale(.97); opacity: 0; }
}
@keyframes mx-toast-in {
  from { transform: translateY(18px) scale(.96); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes mx-toast-out {
  from { transform: translateY(0); opacity: 1; }
  to   { transform: translateY(10px); opacity: 0; }
}
@keyframes mx-scene-in {
  from { transform: translateY(14px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
@keyframes mx-scene-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* ---------- 减少动态：所有 mx- 元素的循环动画只跑一遍（呼吸类直接不动）；按下、进出等状态变化保留 ---------- */

@media (prefers-reduced-motion: reduce) {
  [class*="mx-"], [class*="mx-"]::before, [class*="mx-"]::after {
    animation-iteration-count: 1 !important;
  }
  .mx-anim-breathe, .mx-badge-dot { animation: none !important; }
}

/* ---------- 徽章墙（badges.js，弹窗挂在 body 上） ---------- */
.mx-badges__modal { width: min(100%, 640px); }
.mx-badges__sum { margin: 0 0 12px; font-size: 16px; color: var(--ink-soft); }
.mx-badges__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 16px 12px; padding-top: 8px; }
.mx-badges__item {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 8px 12px;
  border-radius: 16px; background: rgba(0, 0, 0, .035); text-align: center;
}
.mx-badges__icon {
  display: grid; place-items: center; width: 60px; height: 60px; border-radius: 50%;
  background: rgba(0, 0, 0, .06); color: rgba(0, 0, 0, .22);
}
.mx-badges__icon svg { width: 32px; height: 32px; }
.mx-badges__name { font-family: var(--font-display); font-size: 17px; color: var(--ink-soft); }
.mx-badges__desc { font-size: 13px; line-height: 1.35; color: var(--ink-soft); opacity: .8; }
.mx-badges__item.is-on { background: color-mix(in srgb, var(--gold, #d4a017) 12%, transparent); }
.mx-badges__item.is-on .mx-badges__icon {
  background: radial-gradient(circle at 35% 30%, #ffe9a8, var(--gold, #d4a017));
  color: #6b4a00; box-shadow: 0 4px 12px rgba(212, 160, 23, .35), inset 0 1px 0 rgba(255,255,255,.6);
}
.mx-badges__item.is-on .mx-badges__name { color: var(--ink); }
.mx-badges__item { position: relative; }
.mx-badges__ribbon {
  position: absolute; top: -9px; left: 50%; transform: translateX(-50%); white-space: nowrap; padding: 1px 8px; border-radius: 999px;
  background: #d8382c; color: #ffe7a0; font-size: 12px; font-weight: 700; letter-spacing: .05em;
}
.mx-badges__item.is-limited:not(.is-on) { background: color-mix(in srgb, #d8382c 8%, transparent); outline: 1.5px dashed color-mix(in srgb, #d8382c 45%, transparent); }
.mx-badges__item.is-limited.is-on .mx-badges__icon { background: radial-gradient(circle at 35% 30%, #fff6d5, #f7c96a); box-shadow: 0 0 0 3px #d8382c, 0 4px 14px rgba(216, 56, 44, .35); }

/* ---------- 拿到徽章的全屏庆祝（badges.js celebrateBadge）：层级同升级庆祝——场景之上、阳阳（5）与特效（50）之下 ---------- */
.mx-badgewin {
  position: fixed; inset: 0; z-index: 4;
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px;
  background: radial-gradient(circle at 50% 40%, rgba(90, 50, 20, .55), rgba(30, 24, 30, .9) 58%, rgba(24, 20, 28, .95));
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  opacity: 0; transition: opacity 260ms ease; overflow: hidden; touch-action: manipulation;
}
.mx-badgewin.is-on { opacity: 1; }
.mx-badgewin.is-off { opacity: 0; transition-duration: 300ms; }
.mx-badgewin__rays {
  position: absolute; left: 50%; top: 40%; width: 200vmax; height: 200vmax; margin: -100vmax 0 0 -100vmax;
  background: repeating-conic-gradient(from 0deg, rgba(255, 220, 110, .2) 0deg 7deg, rgba(255, 220, 110, 0) 7deg 18deg);
  animation: mx-bw-spin 18s linear infinite; opacity: 0; transition: opacity 600ms ease 300ms;
}
.mx-badgewin.is-landed .mx-badgewin__rays { opacity: 1; }
.mx-badgewin__glow {
  position: absolute; left: 50%; top: 40%; width: 70vmin; height: 70vmin; margin: -35vmin 0 0 -35vmin; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 238, 170, .85), rgba(255, 200, 80, .28) 48%, rgba(255, 200, 80, 0) 72%);
  transform: scale(.2); opacity: 0; transition: transform 700ms cubic-bezier(.2, 1.4, .4, 1), opacity 400ms ease;
}
.mx-badgewin.is-landed .mx-badgewin__glow { transform: scale(1); opacity: 1; animation: mx-bw-pulse 1.4s ease-in-out 700ms infinite; }
/* 冲击波：落地那一刻从奖章往外扩两圈 */
.mx-badgewin__ring {
  position: absolute; left: 50%; top: 40%; width: 200px; height: 200px; margin: -100px 0 0 -100px; border-radius: 50%;
  border: 6px solid rgba(255, 226, 140, .9); opacity: 0; pointer-events: none;
}
.mx-badgewin.is-landed .mx-badgewin__ring { animation: mx-bw-ring 900ms ease-out forwards; }
.mx-badgewin.is-landed .mx-badgewin__ring--2 { animation-delay: 180ms; border-width: 3px; }
.mx-badgewin__stage { position: relative; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; color: #fff6dc; margin-top: -4vh; }
.mx-badgewin__kicker {
  font-family: var(--font-display); font-size: clamp(26px, 4.4vw, 40px); letter-spacing: .08em; color: #ffe39a;
  text-shadow: 0 3px 0 rgba(120, 60, 10, .6), 0 0 24px rgba(255, 200, 80, .6);
  opacity: 0; transform: translateY(-20px) scale(.8); animation: mx-bw-kick 520ms cubic-bezier(.2, 1.5, .4, 1) 520ms forwards;
}
/* 大奖章：从天上转着砸下来（3D 翻三圈）、落地弹两下，之后轻轻浮动；表面一道高光来回扫 */
.mx-badgewin__medal {
  position: relative; width: clamp(170px, 26vmin, 240px); aspect-ratio: 1; border-radius: 50%;
  display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(circle at 35% 28%, #fff6cf, #ffd966 38%, #e6a91e 72%, #b8780b);
  box-shadow: 0 0 0 8px rgba(255, 236, 170, .55), 0 0 0 16px rgba(230, 169, 30, .35), 0 18px 40px rgba(0, 0, 0, .45), inset 0 -10px 20px rgba(150, 90, 0, .35), inset 0 8px 16px rgba(255, 255, 255, .6);
  color: #6b4200;
  transform: translateY(-80vh) rotateY(0) scale(.6);
  animation: mx-bw-drop 1100ms cubic-bezier(.3, .9, .35, 1) forwards, mx-bw-float 3s ease-in-out 1300ms infinite;
}
.mx-badgewin__medal.is-limited { box-shadow: 0 0 0 8px #d8382c, 0 0 0 16px rgba(255, 214, 110, .6), 0 18px 40px rgba(0, 0, 0, .45), inset 0 -10px 20px rgba(150, 90, 0, .35), inset 0 8px 16px rgba(255, 255, 255, .6); }
.mx-badgewin__medal-icon { width: 58%; height: 58%; display: grid; place-items: center; }
.mx-badgewin__medal-icon svg { width: 100%; height: 100%; }
.mx-badgewin__shine {
  position: absolute; inset: -30%; pointer-events: none;
  background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, .75) 50%, transparent 60%);
  transform: translateX(-120%); animation: mx-bw-shine 2.2s ease-in-out 1200ms infinite;
}
.mx-badgewin__name {
  display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: clamp(34px, 6vw, 56px); color: #fff;
  text-shadow: 0 4px 0 rgba(120, 60, 10, .55), 0 0 30px rgba(255, 210, 100, .5);
  opacity: 0; transform: scale(.4); animation: mx-bw-pop 620ms cubic-bezier(.2, 1.6, .4, 1) 900ms forwards;
}
.mx-badgewin__tag { font-family: inherit; font-size: .38em; padding: 3px 12px; border-radius: 999px; background: #d8382c; color: #ffe7a0; text-shadow: none; letter-spacing: .06em; }
.mx-badgewin__desc { font-size: clamp(16px, 2.2vw, 20px); color: #f5e6c4; opacity: 0; animation: mx-bw-fade 500ms ease 1200ms forwards; }
.mx-badgewin__anchor { position: absolute; left: 12%; bottom: 6%; width: 180px; height: 180px; pointer-events: none; }
.mx-badgewin__hint { position: relative; margin-top: 26px; opacity: 0; transform: translateY(12px); transition: opacity 300ms ease, transform 300ms ease; pointer-events: none; }
.mx-badgewin__hint.is-on { opacity: 1; transform: none; pointer-events: auto; }
.mx-badgewin__btn { font-size: 22px; padding: 14px 36px; animation: mx-bw-bob 1.6s ease-in-out infinite; }
@keyframes mx-bw-spin { to { transform: rotate(360deg); } }
@keyframes mx-bw-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }
@keyframes mx-bw-ring { 0% { opacity: .95; transform: scale(.6); } 100% { opacity: 0; transform: scale(3.2); } }
@keyframes mx-bw-kick { to { opacity: 1; transform: none; } }
@keyframes mx-bw-drop {
  0% { transform: translateY(-80vh) rotateY(0) scale(.6); }
  55% { transform: translateY(0) rotateY(1080deg) scale(1.15); }
  70% { transform: translateY(-26px) rotateY(1080deg) scale(.96); }
  82% { transform: translateY(0) rotateY(1080deg) scale(1.04); }
  91% { transform: translateY(-8px) rotateY(1080deg) scale(1); }
  100% { transform: translateY(0) rotateY(1080deg) scale(1); }
}
@keyframes mx-bw-float { 0%, 100% { transform: translateY(0) rotateY(1080deg); } 50% { transform: translateY(-10px) rotateY(1080deg); } }
@keyframes mx-bw-shine { 0% { transform: translateX(-120%); } 55%, 100% { transform: translateX(120%); } }
@keyframes mx-bw-pop { to { opacity: 1; transform: scale(1); } }
@keyframes mx-bw-fade { to { opacity: 1; } }
@keyframes mx-bw-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.mx-badgewin.is-reduced * { animation-duration: 1ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; }
.mx-badgewin.is-reduced .mx-badgewin__medal { transform: none; }

/* ---------- 节日欢迎（badges.js showLimitedWelcome）：沿用徽章庆祝的暗幕 / 光芒，加满月和灯笼 ---------- */
.mx-fwel { background: radial-gradient(circle at 50% 30%, rgba(40, 50, 90, .6), rgba(16, 20, 40, .92) 60%, rgba(10, 12, 28, .96)); }
.mx-fwel__moon {
  position: absolute; right: 12%; top: 8%; width: clamp(90px, 14vmin, 150px); aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 40% 36%, #fffbe8, #ffe7a6 70%, #f7c96a);
  box-shadow: 0 0 40px 14px rgba(255, 220, 140, .45);
}
.mx-fwel__lantern {
  position: absolute; top: 0; width: 46px; height: 58px; border-radius: 45% 45% 40% 40%;
  background: radial-gradient(circle at 50% 55%, #ff8a5c, #d8382c 70%);
  box-shadow: 0 0 26px 8px rgba(255, 120, 60, .45);
  transform-origin: 50% -60px; animation: mx-fl-sway 3.4s ease-in-out infinite;
}
.mx-fwel__lantern::before { content: ''; position: absolute; left: 50%; top: -60px; height: 60px; border-left: 2px solid #7a4a2a; }
.mx-fwel__lantern::after { content: ''; position: absolute; left: 50%; bottom: -22px; height: 22px; border-left: 3px solid #e0b04a; margin-left: -1px; }
.mx-fwel__lantern--l { left: 10%; top: 64px; }
.mx-fwel__lantern--r { left: 22%; top: 40px; animation-delay: -1.2s; width: 36px; height: 46px; }
.mx-fwel__lead { font-size: clamp(16px, 2.2vw, 20px); color: #f5e6c4; opacity: 0; animation: mx-bw-fade 500ms ease 700ms forwards; }
.mx-fwel__medal { animation: mx-bw-pop 700ms cubic-bezier(.2, 1.6, .4, 1) 200ms both, mx-bw-float 3s ease-in-out 1s infinite; transform: scale(.3); opacity: 0; }
.mx-fwel__medal { animation-fill-mode: forwards, none; }
@keyframes mx-bw-pop { to { opacity: 1; transform: scale(1); } }
.mx-fwel__rule { font-size: clamp(18px, 2.6vw, 24px); color: #fff6dc; opacity: 0; animation: mx-bw-fade 500ms ease 1100ms forwards; }
.mx-fwel__rule b { color: #ffd66b; margin: 0 .2em; white-space: nowrap; }
.mx-fwel__actions { display: flex; gap: 14px; }
.mx-fwel .mx-badgewin__name { animation-delay: 500ms; }
/* 横屏：阳阳站到右下角（左边是规则那行字的起头，气泡会压住它） */
@media (orientation: landscape) {
  .mx-fwel .mx-badgewin__anchor { left: auto; right: 4%; bottom: 2%; }
  .mx-fwel__rule { max-width: 20em; }   /* 折成两行，右边给气泡让位 */
}
