/* 通用翻牌组件 —— 参考「草木星河·Today's Floral Pause」的卡背与翻牌动效
   用于：花卡赠礼揭示 / 蜗牛画境解锁 / 呼吸练习奖励 */

.fc {
  perspective: 1400px;
  /* 大卡：看得清草木图的细节（宽 ≤460px，且不超出屏高） */
  width: min(460px, 86vw, 56vh);
  aspect-ratio: 4 / 5;
  cursor: pointer;
}
.fc-inner {
  position: relative;
  width: 100%; height: 100%;
  transform-style: preserve-3d;
  /* transition + 静止 transform（非一次性动画），避免 Chrome 翻面后冻结层内动画 */
  transition: transform 0.95s cubic-bezier(0.34, 0.78, 0.32, 1.04);
}
.fc.flipped .fc-inner { transform: rotateY(180deg); }
/* 翻面后彻底藏起卡背：纹章的 filter 动画会被 Chrome 提升为独立合成层、
   无视 backface-visibility 透到图上（表现为图中央一个金色光点）。
   延迟 0.45s ≈ 翻转过半，视觉无缝。 */
.fc.flipped .fc-front { visibility: hidden; transition: visibility 0s 0.45s; }

.fc-face {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 14px;
  overflow: hidden;
}

/* ---------- 卡背 ---------- */
.fc-front {
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(120% 92% at 50% 14%, #F7EED6 0%, #EEDFBE 44%, #E2CFA1 76%, #D7C18E 100%);
  border: 1px solid rgba(168, 138, 78, 0.6);
  box-shadow:
    0 16px 44px rgba(20, 18, 10, 0.55),
    inset 0 0 0 1px rgba(255, 250, 235, 0.6),
    inset 0 0 0 7px rgba(168, 138, 78, 0.18);
}
.fc-front .fc-aura {
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background: radial-gradient(circle at 50% 43%, rgba(255, 222, 150, 0.55) 0%, rgba(232, 184, 96, 0.24) 30%, transparent 60%);
  animation: fcAura 3.6s ease-in-out infinite;
}
@keyframes fcAura {
  0%, 100% { opacity: 0.45; transform: scale(0.9); }
  50% { opacity: 0.95; transform: scale(1.08); }
}
.fc-front .fc-frame { position: absolute; inset: 13px; border: 1px solid rgba(143, 110, 55, 0.55); }
.fc-front .fc-frame::after { content: ""; position: absolute; inset: 5px; border: 0.5px solid rgba(143, 110, 55, 0.3); }
.fc-front .fc-corners span { position: absolute; width: 18px; height: 18px; border: 1.5px solid rgba(143, 110, 55, 0.78); }
.fc-front .fc-corners span:nth-child(1) { left: 7px; top: 7px; border-right: 0; border-bottom: 0; }
.fc-front .fc-corners span:nth-child(2) { right: 7px; top: 7px; border-left: 0; border-bottom: 0; }
.fc-front .fc-corners span:nth-child(3) { left: 7px; bottom: 7px; border-right: 0; border-top: 0; }
.fc-front .fc-corners span:nth-child(4) { right: 7px; bottom: 7px; border-left: 0; border-top: 0; }
.fc-front .fc-top {
  position: absolute; top: 18px; left: 0; right: 0;
  text-align: center;
  font-style: italic;
  font-size: 15px; letter-spacing: 0.2em;
  color: #96762f;
}
.fc-front .fc-bottom {
  position: absolute; bottom: 16px; left: 0; right: 0;
  text-align: center;
  font-size: 12px; letter-spacing: 0.42em; text-indent: 0.42em;
  color: rgba(150, 118, 47, 0.85);
}
.fc-front .fc-emblem {
  width: 54%; max-width: 138px;
  position: relative; z-index: 2;
  color: #9a7a3f;
  animation: fcGlow 3.6s ease-in-out infinite;
}
@keyframes fcGlow {
  0%, 100% { filter: drop-shadow(0 0 2px rgba(214, 176, 94, 0.6)); }
  50% { filter: drop-shadow(0 0 6px rgba(255, 231, 158, 1)) drop-shadow(0 0 16px rgba(224, 186, 102, 0.9)); }
}

/* 金光横扫（两面都有） */
.fc-front::before, .fc-back::before {
  content: "";
  position: absolute; top: -40%; left: -75%;
  width: 48%; height: 180%;
  z-index: 6; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 245, 210, 0.5), transparent);
  transform: rotate(15deg);
  animation: fcSweep 9s ease-in-out infinite; /* 慢扫：安静赠礼，不要太闹 */
}
@keyframes fcSweep {
  0%, 30% { left: -75%; }
  62%, 100% { left: 145%; }
}

/* ---------- 翻开面 ---------- */
.fc-back {
  transform: rotateY(180deg);
  background: radial-gradient(120% 92% at 50% 14%, #FBF6EC 0%, #F4ECDA 70%, #ECE0C7 100%);
  border: 1px solid rgba(168, 138, 78, 0.42);
}
.fc-back::after {
  content: "";
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(circle at 50% 46%, rgba(255, 240, 205, 0.6) 0%, rgba(255, 226, 160, 0.22) 32%, transparent 64%);
  /* 翻面后只动 opacity，不动 transform（Chrome backface 冻结规避） */
  animation: fcAuraFlat 4.2s ease-in-out infinite;
}
@keyframes fcAuraFlat {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}
.fc-back img {
  display: block; width: 100%; height: 100%;
  object-fit: cover;
  position: relative; z-index: 1;
  animation: fcFruitGlow 4.2s ease-in-out infinite;
}
/* 图片走失时的占位翻开面：米色纸上一枚纹章，不再是刺眼的空白卡 */
.fc-back.fc-back-plain { display: flex; align-items: center; justify-content: center; }
.fc-plain { text-align: center; color: #9a7a3f; position: relative; z-index: 1; }
.fc-plain .fc-emblem { width: 46%; max-width: 150px; margin: 0 auto; display: block; }
.fc-plain-line {
  margin-top: 16px; font-size: 0.8125rem;
  letter-spacing: 0.4em; text-indent: 0.4em;
  color: rgba(150, 118, 47, 0.85);
}
@keyframes fcFruitGlow {
  0%, 100% { filter: drop-shadow(0 5px 13px rgba(120, 90, 40, 0.22)) saturate(1.02) brightness(1); }
  50% { filter: drop-shadow(0 11px 30px rgba(120, 90, 40, 0.4)) saturate(1.12) brightness(1.05); }
}

/* ---------- 整屏揭示浮层 ---------- */
.fc-reveal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(6, 9, 20, 0.82);
  backdrop-filter: blur(4px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px;
  animation: fcFadeIn 1s ease;
  transition: opacity 0.5s ease;
}
.fc-reveal-overlay.fc-out { opacity: 0; pointer-events: none; }
@keyframes fcFadeIn { from { opacity: 0; } to { opacity: 1; } }
.fc-reveal-overlay .fc-line {
  color: #f2f0e4; font-size: 1rem; letter-spacing: 0.16em;
  line-height: 2; text-align: center; white-space: pre-line;
  max-width: min(440px, 86vw);
}
.fc-reveal-overlay .fc-slot { animation: fcRise 1.4s cubic-bezier(0.2, 0.7, 0.3, 1); }
@keyframes fcRise {
  from { opacity: 0; transform: translateY(26px) scale(0.94); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.fc-reveal-overlay .fc-name {
  min-height: 1.5em;
  color: rgba(240, 226, 190, 0.95);
  font-size: 0.9375rem; letter-spacing: 0.2em;
}
.fc-reveal-overlay .fc-btn {
  font-family: inherit; cursor: pointer; border: none;
  background: linear-gradient(180deg, #e9e2c8, #d8cfae); color: #2c3347;
  border-radius: 999px; padding: 10px 30px;
  font-size: 0.9375rem; letter-spacing: 0.14em;
  box-shadow: 0 4px 16px rgba(10, 14, 30, 0.35);
}

/* ---------- 翻牌金光迸发 ---------- */
.fc-spark {
  position: fixed; width: 8px; height: 8px; border-radius: 50%;
  z-index: 300;
  background: radial-gradient(circle, #fff6d8 15%, #f0c987 55%, transparent 75%);
  box-shadow: 0 0 12px 3px rgba(240, 201, 135, 0.8);
  animation: fcSparkFly var(--gd, 1.5s) cubic-bezier(0.2, 0.7, 0.4, 1) forwards;
  pointer-events: none;
}
@keyframes fcSparkFly {
  0% { opacity: 0; transform: translate(0, 0) scale(0.4); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--gx), var(--gy)) scale(0.3); }
}
