/* ============================================
   谁是大诗豪 — 水墨国风动画
   ============================================ */

/* 墨韵扩散 */
@keyframes inkSpread {
  0% {
    clip-path: circle(0% at 50% 50%);
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    clip-path: circle(100% at 50% 50%);
    opacity: 1;
  }
}

.ink-reveal {
  animation: inkSpread 0.8s ease-out forwards;
}

/* 卷轴展开 */
@keyframes scrollUnroll {
  from {
    max-height: 0;
    opacity: 0;
  }
  to {
    max-height: 1000px;
    opacity: 1;
  }
}

.scroll-unroll {
  overflow: hidden;
  animation: scrollUnroll 0.6s ease-out;
}

/* 毛笔书写 */
@keyframes brushWrite {
  from {
    width: 0;
  }
  to {
    width: 100%;
  }
}

.brush-write {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  animation: brushWrite 1.5s steps(20) forwards;
}

/* 印章盖下 */
@keyframes sealStamp {
  0% {
    transform: rotate(-15deg) scale(2);
    opacity: 0;
  }
  60% {
    transform: rotate(-5deg) scale(0.9);
    opacity: 1;
  }
  80% {
    transform: rotate(-9deg) scale(1.05);
  }
  100% {
    transform: rotate(-8deg) scale(1);
    opacity: 1;
  }
}

.seal-stamp {
  animation: sealStamp 0.6s ease-out;
}

/* 墨滴落下 */
@keyframes inkDrop {
  0% {
    transform: translateY(-20px) scale(0.5);
    opacity: 0;
  }
  50% {
    transform: translateY(0) scale(1.1);
    opacity: 1;
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.ink-drop {
  animation: inkDrop 0.4s ease-out;
}

/* 答题正确 */
@keyframes correctPulse {
  0% { box-shadow: 0 0 0 0 rgba(45,106,79,0.4); }
  70% { box-shadow: 0 0 0 15px rgba(45,106,79,0); }
  100% { box-shadow: 0 0 0 0 rgba(45,106,79,0); }
}

.answer-correct {
  animation: correctPulse 0.6s ease-out;
  border-color: var(--success) !important;
  background: rgba(45,106,79,0.05) !important;
}

/* 答题错误 */
@keyframes errorShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.answer-wrong {
  animation: errorShake 0.4s ease-out;
  border-color: var(--error) !important;
  background: rgba(192,57,43,0.05) !important;
}

/* 毛笔减少 */
@keyframes brushBreak {
  0% { transform: rotate(0); }
  30% { transform: rotate(-20deg); }
  60% { transform: rotate(10deg); }
  100% { transform: rotate(0); opacity: 0.25; filter: grayscale(1); }
}

.brush-breaking {
  animation: brushBreak 0.6s ease-out forwards;
}

/* 毛笔恢复 */
@keyframes brushRestore {
  from { opacity: 0.25; filter: grayscale(1); transform: scale(0.8); }
  to { opacity: 1; filter: grayscale(0); transform: scale(1); }
}

.brush-restoring {
  animation: brushRestore 0.5s ease-out forwards;
}

/* 关卡过关 */
@keyframes levelComplete {
  0% { transform: scale(1); }
  30% { transform: scale(1.05); }
  60% { transform: scale(0.97); }
  100% { transform: scale(1); }
}

.level-complete {
  animation: levelComplete 0.5s ease-out;
}

/* 浮入 */
@keyframes floatIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.float-in {
  animation: floatIn 0.4s ease-out;
}

.float-in-delay-1 { animation: floatIn 0.4s ease-out 0.1s both; }
.float-in-delay-2 { animation: floatIn 0.4s ease-out 0.2s both; }
.float-in-delay-3 { animation: floatIn 0.4s ease-out 0.3s both; }

/* 全局加载器 */
.global-loader {
  position: fixed;
  inset: 0;
  background: rgba(250,247,242,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-loading);
}

.loader-ink {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}

.loader-brush {
  width: 40px;
  height: 40px;
  border: 3px solid var(--ink-lighter);
  border-top-color: var(--ink-dark);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loader-text {
  font-family: var(--font-title);
  font-size: var(--text-sm);
  color: var(--ink-light);
  animation: fadePulse 1.5s ease-in-out infinite;
}

@keyframes fadePulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* 星星评分 */
@keyframes starPop {
  0% { transform: scale(0); }
  60% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.star-pop {
  animation: starPop 0.3s ease-out;
}

/* ====== 字海寻踪：汉字飘浮动效 ====== */
@keyframes charFloat {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  25% {
    transform: translateY(-4px) rotate(-2deg);
  }
  75% {
    transform: translateY(4px) rotate(2deg);
  }
}

@keyframes charDrift {
  0% {
    transform: translate(0, 0);
  }
  33% {
    transform: translate(3px, -2px);
  }
  66% {
    transform: translate(-3px, 2px);
  }
  100% {
    transform: translate(0, 0);
  }
}

.hunt-char {
  animation: charFloat 3s ease-in-out infinite;
  transition: all 0.2s ease !important;
}

.hunt-char:nth-child(odd) {
  animation-name: charDrift;
  animation-duration: 4s;
}

.hunt-char:nth-child(2n) {
  animation-duration: 2.5s;
}

.hunt-char:nth-child(3n) {
  animation-name: charDrift;
  animation-duration: 3.5s;
}

.hunt-char:nth-child(5n) {
  animation-name: charFloat;
  animation-duration: 3.8s;
}

.hunt-char:hover {
  transform: scale(1.15) !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  border-color: var(--ink-dark) !important;
  z-index: 10;
}

.hunt-char.used {
  animation: none;
  opacity: 0.3 !important;
  transform: scale(0.9);
}

/* ====== 飞花雅令：倒计时闪烁 ====== */
@keyframes countdownPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.flower-countdown.urgent {
  animation: countdownPulse 0.5s ease-in-out infinite;
  color: var(--error);
}

/* ====== 诗魂对决：HP条伤害闪动 ====== */
@keyframes hpDamage {
  0% { filter: brightness(1.5); }
  50% { filter: brightness(0.8); }
  100% { filter: brightness(1); }
}

.hp-damage {
  animation: hpDamage 0.3s ease-out;
}
