/* ============================================
   动画样式 - 英语单词对战游戏
   ============================================ */

/* 抖动动画 */
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

.shake {
    animation: shake 0.3s ease;
}

/* 屏幕抖动 - 增强版 */
@keyframes screenShakeLight {
    0%, 100% {
        transform: translate(0, 0);
    }
    20% {
        transform: translate(-3px, -2px);
    }
    40% {
        transform: translate(3px, 2px);
    }
    60% {
        transform: translate(-2px, 3px);
    }
    80% {
        transform: translate(2px, -3px);
    }
}

@keyframes screenShake {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
    }
    10% {
        transform: translate(-6px, -4px) rotate(-0.5deg);
    }
    20% {
        transform: translate(6px, 4px) rotate(0.5deg);
    }
    30% {
        transform: translate(-4px, 6px) rotate(-0.3deg);
    }
    40% {
        transform: translate(4px, -6px) rotate(0.3deg);
    }
    50% {
        transform: translate(-6px, 4px) rotate(-0.5deg);
    }
    60% {
        transform: translate(6px, -4px) rotate(0.5deg);
    }
    70% {
        transform: translate(-4px, -6px) rotate(-0.3deg);
    }
    80% {
        transform: translate(4px, 6px) rotate(0.3deg);
    }
    90% {
        transform: translate(-6px, -4px) rotate(-0.5deg);
    }
}

@keyframes screenShakeHeavy {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg) scale(1);
    }
    5% {
        transform: translate(-10px, -6px) rotate(-1deg) scale(1.01);
    }
    10% {
        transform: translate(10px, 6px) rotate(1deg) scale(0.99);
    }
    15% {
        transform: translate(-8px, 10px) rotate(-0.8deg) scale(1.02);
    }
    20% {
        transform: translate(8px, -10px) rotate(0.8deg) scale(0.98);
    }
    25% {
        transform: translate(-10px, 8px) rotate(-1deg) scale(1.01);
    }
    30% {
        transform: translate(10px, -8px) rotate(1deg) scale(0.99);
    }
    35% {
        transform: translate(-6px, -10px) rotate(-0.5deg) scale(1.01);
    }
    40% {
        transform: translate(6px, 10px) rotate(0.5deg) scale(0.99);
    }
    45% {
        transform: translate(-10px, -6px) rotate(-1deg) scale(1.01);
    }
    50% {
        transform: translate(10px, 6px) rotate(1deg) scale(0.99);
    }
    55% {
        transform: translate(-8px, 10px) rotate(-0.8deg) scale(1.01);
    }
    60% {
        transform: translate(8px, -10px) rotate(0.8deg) scale(0.99);
    }
    65% {
        transform: translate(-6px, -8px) rotate(-0.5deg) scale(1.01);
    }
    70% {
        transform: translate(6px, 8px) rotate(0.5deg) scale(0.99);
    }
    75% {
        transform: translate(-8px, -6px) rotate(-0.8deg) scale(1.005);
    }
    80% {
        transform: translate(8px, 6px) rotate(0.8deg) scale(0.995);
    }
    85% {
        transform: translate(-4px, 4px) rotate(-0.3deg) scale(1);
    }
    90% {
        transform: translate(4px, -4px) rotate(0.3deg) scale(1);
    }
}

@keyframes screenShakeExtreme {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg) scale(1);
    }
    2% {
        transform: translate(-15px, -10px) rotate(-2deg) scale(1.02);
    }
    4% {
        transform: translate(15px, 10px) rotate(2deg) scale(0.98);
    }
    6% {
        transform: translate(-12px, 15px) rotate(-1.5deg) scale(1.02);
    }
    8% {
        transform: translate(12px, -15px) rotate(1.5deg) scale(0.98);
    }
    10% {
        transform: translate(-15px, 12px) rotate(-2deg) scale(1.02);
    }
    12% {
        transform: translate(15px, -12px) rotate(2deg) scale(0.98);
    }
    14% {
        transform: translate(-10px, -15px) rotate(-1.2deg) scale(1.015);
    }
    16% {
        transform: translate(10px, 15px) rotate(1.2deg) scale(0.985);
    }
    18% {
        transform: translate(-15px, 10px) rotate(-2deg) scale(1.02);
    }
    20% {
        transform: translate(15px, -10px) rotate(2deg) scale(0.98);
    }
    25% {
        transform: translate(-12px, 12px) rotate(-1.5deg) scale(1.01);
    }
    30% {
        transform: translate(12px, -12px) rotate(1.5deg) scale(0.99);
    }
    35% {
        transform: translate(-10px, -10px) rotate(-1deg) scale(1.01);
    }
    40% {
        transform: translate(10px, 10px) rotate(1deg) scale(0.99);
    }
    45% {
        transform: translate(-8px, 8px) rotate(-0.8deg) scale(1.008);
    }
    50% {
        transform: translate(8px, -8px) rotate(0.8deg) scale(0.992);
    }
    60% {
        transform: translate(-6px, 6px) rotate(-0.5deg) scale(1.005);
    }
    70% {
        transform: translate(6px, -6px) rotate(0.5deg) scale(0.995);
    }
    80% {
        transform: translate(-4px, 4px) rotate(-0.3deg) scale(1.003);
    }
    90% {
        transform: translate(4px, -4px) rotate(0.3deg) scale(0.997);
    }
}

.screen-shake {
    animation: screenShake 0.3s ease;
}

.screen-shake-light {
    animation: screenShakeLight 0.15s ease;
}

.screen-shake-medium {
    animation: screenShake 0.3s ease;
}

.screen-shake-heavy {
    animation: screenShakeHeavy 0.45s ease;
}

.screen-shake-extreme {
    animation: screenShakeExtreme 0.6s ease;
}

/* 淡入淡出 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

.fade-in {
    animation: fadeIn 0.3s ease forwards;
}

.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

/* 缩放动画 */
@keyframes scaleIn {
    from {
        transform: scale(0);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes scaleOut {
    from {
        transform: scale(1);
        opacity: 1;
    }
    to {
        transform: scale(0);
        opacity: 0;
    }
}

.scale-in {
    animation: scaleIn 0.3s ease forwards;
}

/* 正确反馈动画 */
@keyframes correctPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(34, 197, 94, 0);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 30px rgba(34, 197, 94, 0.8);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(34, 197, 94, 0.5);
    }
}

.correct-pulse {
    animation: correctPulse 0.5s ease;
}

/* 错误反馈动画 */
@keyframes wrongPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(239, 68, 68, 0);
    }
    25% {
        transform: scale(0.95);
    }
    50% {
        box-shadow: 0 0 30px rgba(239, 68, 68, 0.8);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(239, 68, 68, 0);
    }
}

.wrong-pulse {
    animation: wrongPulse 0.5s ease;
}

/* 爱心消失动画 */
@keyframes heartBreak {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.5;
    }
    100% {
        transform: scale(0);
        opacity: 0;
    }
}

.heart-break {
    animation: heartBreak 0.4s ease forwards;
}

/* 爱心恢复动画 */
@keyframes heartHeal {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.8;
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.heart-heal {
    animation: heartHeal 0.5s ease forwards;
}

/* 发光动画 */
@keyframes glow {
    0%, 100% {
        filter: drop-shadow(0 0 5px currentColor);
    }
    50% {
        filter: drop-shadow(0 0 20px currentColor);
    }
}

.glow {
    animation: glow 1.5s ease-in-out infinite;
}

/* 脉冲动画 */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

.pulse {
    animation: pulse 1s ease-in-out infinite;
}

/* 旋转动画 */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.spin {
    animation: spin 1s linear infinite;
}

/* 弹跳动画 */
@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.bounce {
    animation: bounce 0.6s ease-in-out infinite;
}

/* 闪烁动画 */
@keyframes blink {
    0%, 50%, 100% {
        opacity: 1;
    }
    25%, 75% {
        opacity: 0.3;
    }
}

.blink {
    animation: blink 0.5s ease-in-out 3;
}

/* 背景闪光 - 增强版 */
@keyframes flashBackground {
    0% {
        background-color: transparent;
        filter: brightness(1);
    }
    30% {
        background-color: rgba(244, 114, 182, 0.4);
        filter: brightness(1.3);
    }
    60% {
        background-color: rgba(168, 85, 247, 0.2);
        filter: brightness(1.2);
    }
    100% {
        background-color: transparent;
        filter: brightness(1);
    }
}

@keyframes flashRed {
    0% {
        background-color: transparent;
        filter: brightness(1);
    }
    20% {
        background-color: rgba(239, 68, 68, 0.5);
        filter: brightness(0.8) saturate(1.5);
    }
    50% {
        background-color: rgba(185, 28, 28, 0.3);
        filter: brightness(0.9);
    }
    100% {
        background-color: transparent;
        filter: brightness(1);
    }
}

@keyframes flashGold {
    0% {
        background-color: transparent;
        filter: brightness(1);
    }
    30% {
        background-color: rgba(251, 191, 36, 0.4);
        filter: brightness(1.4) sepia(0.3);
    }
    60% {
        background-color: rgba(245, 158, 11, 0.2);
        filter: brightness(1.2);
    }
    100% {
        background-color: transparent;
        filter: brightness(1);
    }
}

@keyframes flashUltimate {
    0% {
        background-color: transparent;
        filter: brightness(1) hue-rotate(0deg);
    }
    20% {
        background: linear-gradient(45deg, 
            rgba(236, 72, 153, 0.5), 
            rgba(168, 85, 247, 0.5), 
            rgba(6, 182, 212, 0.5));
        filter: brightness(1.5) hue-rotate(20deg);
    }
    40% {
        background: linear-gradient(135deg, 
            rgba(245, 158, 11, 0.4), 
            rgba(239, 68, 68, 0.4), 
            rgba(34, 197, 94, 0.4));
        filter: brightness(1.3);
    }
    60% {
        background: linear-gradient(225deg, 
            rgba(139, 92, 246, 0.5), 
            rgba(236, 72, 153, 0.5));
        filter: brightness(1.4) hue-rotate(-20deg);
    }
    80% {
        background-color: rgba(251, 191, 36, 0.2);
        filter: brightness(1.2);
    }
    100% {
        background-color: transparent;
        filter: brightness(1) hue-rotate(0deg);
    }
}

.flash-bg {
    animation: flashBackground 0.3s ease;
}

.flash-red {
    animation: flashRed 0.5s ease;
}

.flash-gold {
    animation: flashGold 0.4s ease;
}

.flash-ultimate {
    animation: flashUltimate 0.6s ease;
}

/* 成就解锁动画 */
@keyframes achievementUnlock {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(10deg);
    }
    75% {
        transform: scale(0.9) rotate(-5deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.achievement-unlock {
    animation: achievementUnlock 0.6s ease forwards;
}

/* 打字机效果 */
@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

.typing {
    overflow: hidden;
    white-space: nowrap;
    animation: typing 2s steps(30) forwards;
}

/* 滑入动画 */
@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.slide-in-left {
    animation: slideInLeft 0.4s ease forwards;
}

.slide-in-right {
    animation: slideInRight 0.4s ease forwards;
}

.slide-in-up {
    animation: slideInUp 0.4s ease forwards;
}

.slide-in-down {
    animation: slideInDown 0.4s ease forwards;
}

/* 渐变流动 */
@keyframes gradientFlow {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.gradient-flow {
    background-size: 200% 200%;
    animation: gradientFlow 3s ease infinite;
}

/* 彩虹效果 */
@keyframes rainbow {
    0% {
        filter: hue-rotate(0deg);
    }
    100% {
        filter: hue-rotate(360deg);
    }
}

.rainbow {
    animation: rainbow 2s linear infinite;
}

/* 按钮按下效果 */
.btn:active {
    transform: scale(0.95);
}

/* 涟漪效果 */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.ripple:active::after {
    width: 300px;
    height: 300px;
}

/* 呼吸动画 */
@keyframes breathe {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}

.breathe {
    animation: breathe 3s ease-in-out infinite;
}

/* 震动闪烁 */
@keyframes vibrateFlash {
    0%, 100% {
        transform: translateX(0);
        opacity: 1;
    }
    25% {
        transform: translateX(-3px);
        opacity: 0.5;
    }
    50% {
        transform: translateX(3px);
        opacity: 1;
    }
    75% {
        transform: translateX(-3px);
        opacity: 0.5;
    }
}

.vibrate-flash {
    animation: vibrateFlash 0.3s ease;
}

/* 爆炸扩散 */
@keyframes explode {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(2);
        opacity: 0;
    }
}

.explode {
    animation: explode 0.5s ease forwards;
}

/* 收起动画 */
@keyframes collapse {
    0% {
        max-height: 1000px;
        opacity: 1;
    }
    100% {
        max-height: 0;
        opacity: 0;
    }
}

.collapse {
    animation: collapse 0.3s ease forwards;
}

/* 展开动画 */
@keyframes expand {
    0% {
        max-height: 0;
        opacity: 0;
    }
    100% {
        max-height: 1000px;
        opacity: 1;
    }
}

.expand {
    animation: expand 0.3s ease forwards;
}

/* ============================================
   倒计时样式
   ============================================ */

/* 倒计时容器 */
.countdown-container {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100;
}

.countdown-ring {
    position: relative;
    width: 70px;
    height: 70px;
}

.countdown-svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.countdown-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 6;
}

.countdown-progress {
    fill: none;
    stroke: #22C55E;
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear, stroke 0.3s ease;
}

.countdown-number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 28px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    transition: transform 0.1s ease, color 0.3s ease;
}

/* 倒计时紧急状态 */
.countdown-urgent {
    color: #FBBF24;
}

.countdown-urgent + .countdown-svg .countdown-progress {
    stroke: #FBBF24;
}

/* 倒计时危险状态 */
.countdown-critical {
    color: #EF4444;
    animation: countdownPulse 0.5s ease infinite;
}

.countdown-critical + .countdown-svg .countdown-progress {
    stroke: #EF4444;
    filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.8));
}

/* 倒计时脉冲动画 */
@keyframes countdownPulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.15);
    }
}

.countdown-pulse {
    animation: countdownPulse 0.3s ease;
}

/* 超时提示样式 */
.timeout-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    pointer-events: none;
}

.timeout-content {
    background: rgba(239, 68, 68, 0.9);
    padding: 30px 60px;
    border-radius: 20px;
    text-align: center;
    animation: timeoutBounce 0.5s ease;
    box-shadow: 0 0 50px rgba(239, 68, 68, 0.5);
}

.timeout-icon {
    font-size: 60px;
    margin-bottom: 10px;
}

.timeout-text {
    font-size: 36px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

@keyframes timeoutBounce {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.timeout-overlay.fade-out {
    animation: fadeOut 0.5s ease forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
    }
}
