/* 迪士尼 12 原则驱动的动效、里程碑演出与终局评定卷 */

.milestone-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  overflow: hidden;
}

/* 礼制共鸣横幅（Balatro 倍率弹跳感） */
.synergy-banner {
  position: absolute;
  top: 22%;
  left: 14px;
  right: 14px;
  border-radius: 16px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(28, 20, 16, 0.96), rgba(62, 32, 22, 0.96));
  border: 2px solid #f6b93b;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.55);
  text-align: center;
  color: #fff8eb;
  animation: popElastic 0.45s var(--ease-overshoot);
}

.synergy-banner-tag {
  font-size: 10px;
  letter-spacing: 0.18em;
  color: #fde68a;
}

.synergy-banner-title {
  margin-top: 3px;
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 700;
}

.synergy-banner-mult {
  margin-top: 2px;
  font-size: 26px;
  font-weight: 900;
  color: #00e5b8;
  text-shadow: 0 0 18px rgba(0, 229, 184, 0.55);
}

.synergy-banner-desc {
  margin-top: 4px;
  font-size: 12px;
  opacity: 0.88;
}

/* 朱砂砸印（Squash & Stretch + Follow Through） */
.stamp-popup {
  position: absolute;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-10deg);
  border: 3.5px solid #e13b2d;
  border-radius: 10px;
  padding: 8px 16px;
  background: rgba(185, 58, 44, 0.92);
  color: #fff9f0;
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.1em;
  white-space: nowrap;
  max-width: 90%;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  animation: stampSlam 0.5s var(--ease-overshoot);
}

/* 飘浮积分 +pt */
.float-pt-layer {
  position: absolute;
  inset: 0;
}

.float-pt {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translateX(-50%);
  font-size: 20px;
  font-weight: 900;
  color: #fde68a;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.85);
  animation: floatUpFade 1.05s var(--ease-out-expo) forwards;
}

.float-pt.negative {
  color: #fca5a5;
}

/* 卡牌 Overshoot 入场 & Squash/Stretch */
.card-3d.is-entering {
  animation: cardLand 0.52s var(--ease-overshoot);
}

.card-3d.is-awakening {
  animation: awakenPulse 0.65s var(--ease-overshoot);
}

/* 大典圆满评定卷轴弹窗 */
.finale-modal {
  position: absolute;
  inset: 0;
  z-index: 75;
  background: rgba(12, 10, 15, 0.82);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.finale-scroll {
  width: 100%;
  background: linear-gradient(175deg, #fffcf5 0%, #f1e5cf 100%);
  border: 2.5px solid #c9963b;
  border-radius: 20px;
  padding: 18px 16px;
  color: #1f1c18;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
  animation: popElastic 0.45s var(--ease-overshoot);
  max-height: 92%;
  overflow-y: auto;
}

.finale-top-ornament {
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--crimson-dark);
  font-weight: 700;
}

.finale-rank-seal {
  width: 64px;
  height: 64px;
  margin: 8px auto 6px;
  border-radius: 14px;
  border: 3px solid var(--crimson);
  background: rgba(185, 58, 44, 0.1);
  color: var(--crimson);
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 900;
  display: grid;
  place-items: center;
  transform: rotate(-6deg);
}

.finale-scroll h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 24px;
}

.finale-scroll > p {
  margin: 4px 0 12px;
  font-size: 12px;
  color: var(--ink-secondary);
}

.finale-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.metric-box {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 8px 6px;
}

.m-label {
  display: block;
  font-size: 10px;
  color: var(--ink-secondary);
}

.m-val {
  font-size: 16px;
  color: var(--crimson-dark);
}

.finale-slots-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  text-align: left;
  margin-bottom: 8px;
}

.finale-slot-chip {
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--border-light);
  font-size: 11px;
}

.finale-synergies {
  font-size: 11px;
  color: var(--crimson-dark);
  font-weight: 600;
  margin-bottom: 12px;
}

.finale-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* 关键帧动画 */
@keyframes popElastic {
  0% { opacity: 0; transform: scale(0.76) translateY(14px); }
  70% { opacity: 1; transform: scale(1.04) translateY(-2px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes cardLand {
  0% { opacity: 0; transform: scale(0.62, 1.15) translateY(42px); }
  62% { opacity: 1; transform: scale(1.07, 0.94) translateY(-6px); }
  100% { opacity: 1; transform: scale(1, 1) translateY(0); }
}

@keyframes awakenPulse {
  0% { transform: scale(1); filter: brightness(1); }
  35% { transform: scale(0.92); filter: brightness(2.2); }
  72% { transform: scale(1.1); filter: brightness(1.3); }
  100% { transform: scale(1); filter: brightness(1); }
}

@keyframes stampSlam {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(2.1) rotate(-18deg); }
  60% { opacity: 1; transform: translate(-50%, -50%) scale(0.92, 1.06) rotate(-9deg); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1, 1) rotate(-10deg); }
}

@keyframes floatUpFade {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(0.8); }
  22% { opacity: 1; transform: translate(-50%, -12px) scale(1.12); }
  100% { opacity: 0; transform: translate(-50%, -62px) scale(0.95); }
}

@keyframes suspensePulse {
  0% { transform: scale(1); }
  45% { transform: scale(1.12); box-shadow: 0 0 28px rgba(246, 185, 59, 0.85); }
  100% { transform: scale(1); }
}

@keyframes pulseUrgent {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

@keyframes pulseGold {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

/* ===== v0.2：高稀有度全屏拉近揭晓（时间参数见 docs/REF_VIDEO_TIMING.md） ===== */
.rare-pullout {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 6, 14, 0.78);
  cursor: pointer;
}

.rare-pullout.hidden { display: none !important; }

.pullout-rays {
  position: absolute;
  inset: -40%;
  background: repeating-conic-gradient(from 0deg, rgba(140, 40, 90, 0.34) 0deg 9deg, rgba(0, 0, 0, 0) 9deg 18deg);
  animation: raysSpin 26s linear infinite;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.rare-pullout.is-revealed .pullout-rays { opacity: 1; }

.pullout-rings {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
}

.pullout-ring {
  position: absolute;
  left: -150px;
  top: -150px;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: conic-gradient(#ff6ec4, #ffd36e, #6effc4, #6ec4ff, #c46eff, #ff6ec4);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 9px), #000 calc(100% - 8px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 9px), #000 calc(100% - 8px));
  opacity: 0;
  animation: ringPulse 0.9s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
  filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.8));
}

.pullout-card {
  position: relative;
  width: 214px;
  height: 306px;
  perspective: 900px;
  transform: scale(0.45);
  opacity: 0;
}

.rare-pullout.is-entering .pullout-card {
  animation: pulloutIn 0.42s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.rare-pullout.is-revealed .pullout-card {
  transform: scale(1);
  opacity: 1;
}

.pullout-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.16s ease-in;
}

.rare-pullout.is-revealed .pullout-inner { transform: rotateY(180deg); }

.pullout-face {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}

.pullout-back {
  background: linear-gradient(160deg, #251a1d, #130f14);
  border: 2.5px solid #d4a54a;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pullout-back-seal {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 3px solid #d4a54a;
  color: #fde68a;
  font-family: var(--font-serif);
  font-size: 40px;
  display: grid;
  place-items: center;
  box-shadow: 0 0 24px rgba(246, 185, 59, 0.45);
}

.pullout-front {
  transform: rotateY(180deg);
  background: #0f1d20;
  border: 2.5px solid #00e5b8;
  display: flex;
  flex-direction: column;
  padding: 10px;
  color: #fff;
}

.pullout-front.rarity-UR { background: #2b1f0c; border-color: #f6b93b; }
.pullout-front .pf-name { font-family: var(--font-serif); font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.pullout-front .pf-art { flex: 1; min-height: 0; background: radial-gradient(circle at 50% 45%, rgba(246, 185, 59, 0.24), rgba(13, 12, 18, 0.94) 72%); border-radius: 10px; padding: 10px; box-sizing: border-box; }
.pullout-front .pf-meta { font-size: 11px; opacity: 0.85; margin-top: 6px; }

.pullout-glyph {
  position: absolute;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%) scale(0.6);
  font-size: 76px;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: rgba(255, 245, 210, 0.95);
  text-shadow: 0 0 22px rgba(255, 210, 120, 0.95), 0 0 48px rgba(255, 120, 200, 0.7);
  opacity: 0;
  pointer-events: none;
}

.rare-pullout.is-revealed .pullout-glyph {
  animation: glyphFlash 1.6s ease-out forwards;
}

.pullout-hint {
  position: absolute;
  bottom: 54px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  opacity: 0;
}

.rare-pullout.is-ready .pullout-hint { opacity: 1; }

/* 连抽下一张待翻牌的金色提示（对应参考视频：翻牌前该牌描金） */
.mini-flip-card.is-next .mini-back {
  border-color: #fde68a;
  box-shadow: 0 0 14px rgba(253, 230, 138, 0.85);
}

@keyframes raysSpin { to { transform: rotate(360deg); } }
@keyframes pulloutIn {
  0% { transform: scale(0.45); opacity: 0; }
  55% { transform: scale(1.08); opacity: 1; }
  78% { transform: scale(0.94); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes ringPulse {
  0% { transform: scale(0.35); opacity: 0.95; }
  100% { transform: scale(2.1); opacity: 0; }
}
@keyframes glyphFlash {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.6); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
  70% { opacity: 0.85; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(1.05); }
}

/* 层级：彩带画布在最上层，稀有揭晓遮罩在其下，面板与顶栏之上 */
#fx-canvas { z-index: 48; }
.rare-pullout { z-index: 47; }
.back-source { font-size: 10px; color: rgba(255, 238, 200, 0.6); line-height: 1.4; }
