.word-matching-game {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(-45deg, #f5f7fa, #e4e9f2, #dfe9f3, #ffffff);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    border-radius: 20px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.05);
}

.game-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding: 15px;
    border-radius: 15px;
}

.game-container {
    display: flex;
    justify-content: space-between;
    gap: 40px;
    margin: 20px 0;
    padding: 10px;
}

.word-column {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-content: flex-start;
    padding: 35px 25px 25px 25px;
    border: none;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(10px);
    position: relative;
    min-height: 300px;
    justify-content: center;
}

.word-card {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    background: #ffffff;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-size: 20px;
    font-weight: 500;
    color: #2c3e50;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.08);
    margin: 0;
    white-space: nowrap;
    flex-grow: 0;
    flex-shrink: 0;
}

.word-card:hover {
    transform: perspective(1000px) translateZ(20px) translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    background: linear-gradient(135deg, #ffffff 0%, #f0f0f0 100%);
}

.word-card.selected {
    background: linear-gradient(45deg, #4CAF50, #45a049, #2E7D32);
    background-size: 200% 200%;
    animation: selectedPulse 1.5s infinite, gradientMove 3s ease infinite;
    color: white;
    border: none;
    box-shadow: 0 6px 15px rgba(76, 175, 80, 0.3);
}

.word-card.matched {
    pointer-events: none;
    opacity: 0;
    position: relative;
    visibility: hidden;
    margin: 0;
    padding: 12px 24px;
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
    transition: opacity 0.5s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-grow: 0;
    flex-shrink: 0;
    white-space: nowrap;
    font-size: 20px;
    width: auto;
    min-width: min-content;
    height: auto;
}

.word-card.matched::before,
.word-card.matched::after {
    display: none;
}

/* 游戏完成弹窗样式 */
#game-complete {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
    z-index: 1000;
    min-width: 300px;
    animation: popIn 0.3s ease-out;
    padding: 35px;
}

/* 弹窗背景遮罩 */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    animation: fadeIn 0.3s ease-out;
}

/* 弹窗动画 */
@keyframes popIn {
    0% {
        transform: translate(-50%, -60%) scale(0.8);
        opacity: 0;
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

@keyframes fadeIn {
    0% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

/* 弹窗内容样式 */
#game-complete h2 {
    font-size: 28px;
    color: #2E7D32;
    margin-bottom: 25px;
    font-weight: 600;
}

#game-complete p {
    margin: 10px 0;
    font-size: 16px;
    color: #333;
}

/* 优化再玩一次按钮样式 */
#game-complete button {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    padding: 15px 35px;
    font-size: 17px;
    font-weight: 600;
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 6px 15px rgba(76, 175, 80, 0.25);
    position: relative;
    overflow: hidden;
    margin-top: 25px;
    letter-spacing: 0.5px;
}

#game-complete button:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 20px rgba(76, 175, 80, 0.35);
    background: linear-gradient(135deg, #45a049 0%, #388E3C 100%);
}

#game-complete button:active {
    transform: translateY(1px) scale(0.98);
    box-shadow: 0 4px 10px rgba(76, 175, 80, 0.2);
}

/* 添加按钮点击波纹效果 */
#game-complete button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

#game-complete button:focus:not(:active)::after {
    animation: ripple 1s ease-out;
}

/* 添加波纹动画 */
@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 0.5;
    }
    20% {
        transform: scale(25, 25);
        opacity: 0.3;
    }
    100% {
        opacity: 0;
        transform: scale(40, 40);
    }
}

/* 移动端适配 */
@media (max-width: 768px) {
    .word-matching-game {
        padding: 10px;
        border-radius: 15px;
        width: 100%;
        box-sizing: border-box;
    }

    .game-container {
        flex-direction: column;
        gap: 35px;
        margin: 15px 0;
        width: 100%;
    }
    
    .word-column {
        width: 100%;
        min-height: auto;
        padding: 35px 15px 15px 15px;
        gap: 10px;
    }
    
    .word-card {
        font-size: 18px;
        padding: 10px 20px;
    }

    .word-card.matched {
        font-size: 18px;
        padding: 10px 20px;
    }
}

@media (max-width: 480px) {
    .word-column {
        padding: 35px 10px 15px 10px;
        gap: 8px;
    }
    
    .word-card {
        font-size: 16px;
        padding: 8px 16px;
    }

    .word-card.matched {
        font-size: 16px;
        padding: 8px 16px;
    }
}

@keyframes cardAppear {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
        filter: blur(5px);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

@keyframes cardVanish {
    0% {
        opacity: 1;
        transform: scale(1) rotate(0);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.2) rotate(5deg);
    }
    100% {
        opacity: 0;
        transform: scale(0) rotate(15deg);
    }
}

/* 修改英文组标题样式 */
#english-words::before {
    content: '英文单词';
    position: absolute;
    top: -12px;
    left: 20px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    padding: 6px 25px;
    font-weight: 600;
    color: #1a1a1a;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    letter-spacing: 0.5px;
    animation: titleFloat 3s ease-in-out infinite;
}

/* 修改中文组标题样式 */
#chinese-words::before {
    content: '中文词义';
    position: absolute;
    top: -12px;
    left: 20px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    padding: 6px 25px;
    font-weight: 600;
    color: #1a1a1a;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    letter-spacing: 0.5px;
    animation: titleFloat 3s ease-in-out infinite;
}

/* 当选中英文卡片时，高亮英文组边框 */
#english-words:has(.selected) {
    border-color: #4CAF50;
    box-shadow: 0 4px 12px rgba(76,175,80,0.2);
}

/* 当选中中文卡片时，高亮中文组边框 */
#chinese-words:has(.selected) {
    border-color: #4CAF50;
    box-shadow: 0 4px 12px rgba(76,175,80,0.2);
}

/* 修改奖励栏样式 */
.rewards {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: visible;
    transition: box-shadow 0.3s ease;
}

.rewards.glow {
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

.flower-count {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    min-width: 20px;
    text-align: center;
    transition: transform 0.3s ease;
}

.flower-icon {
    width: 20px;
    height: 20px;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="%23FFD700" d="M12,17.27L18.18,21L16.54,13.97L22,9.24L14.81,8.62L12,2L9.19,8.62L2,9.24L7.45,13.97L5.82,21L12,17.27Z"/></svg>') no-repeat center;
    animation: iconRotate 4s linear infinite;
}

@keyframes iconRotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* 添加飞行动画的卡片样式 */
.flying-card {
    position: fixed;
    z-index: 1001;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    animation: flyAndRotate 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes flyAndRotate {
    0% {
        transform: rotate(0deg) scale(1);
    }
    50% {
        transform: rotate(180deg) scale(1.2);
    }
    100% {
        transform: rotate(360deg) scale(0);
    }
}

/* 碰撞动画 */
@keyframes collide {
    0% {
        transform: scale(1) rotate(0deg);
    }
    50% {
        transform: scale(1.2) rotate(180deg);
    }
    100% {
        transform: scale(0) rotate(360deg);
    }
}

/* 小红花出现动画 */
@keyframes flowerAppear {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.5) rotate(180deg);
        opacity: 0.8;
    }
    100% {
        transform: scale(1) rotate(360deg);
        opacity: 1;
    }
}

/* 小红花飞向奖励栏动画 */
@keyframes flyToRewards {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
    50% {
        transform: scale(0.8) rotate(360deg);
        opacity: 0.8;
    }
    100% {
        transform: scale(0.3) rotate(720deg);
        opacity: 0;
    }
}

/* 修改奖励栏计数动画 */
@keyframes countBump {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.3);
    }
    100% {
        transform: scale(1);
    }
}

/* 修改星星飞行动画 */
@keyframes starFly {
    0% {
        transform: scale(1) rotate(0deg);
        filter: brightness(1) blur(0);
        opacity: 1;
    }
    25% {
        transform: scale(1.2) rotate(180deg);
        filter: brightness(1.5) blur(0);
        opacity: 1;
    }
    50% {
        transform: scale(1) rotate(360deg);
        filter: brightness(2) blur(2px);
        opacity: 0.8;
    }
    75% {
        transform: scale(0.6) rotate(540deg);
        filter: brightness(2.5) blur(1px);
        opacity: 0.6;
    }
    100% {
        transform: scale(0.3) rotate(720deg);
        filter: brightness(3) blur(0);
        opacity: 0;
    }
}

/* 修改星星样式 */
.flower {
    position: fixed;
    width: 40px;
    height: 40px;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="%23FFD700" d="M12,17.27L18.18,21L16.54,13.97L22,9.24L14.81,8.62L12,2L9.19,8.62L2,9.24L7.45,13.97L5.82,21L12,17.27Z"/></svg>') no-repeat center;
    pointer-events: none;
    z-index: 1002;
    filter: drop-shadow(0 0 5px rgba(255, 215, 0, 0.5));
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 星星轨迹光效 */
.star-trail {
    position: fixed;
    pointer-events: none;
    z-index: 1001;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 215, 0, 0.3);
    animation: fadeOut 1s ease-out forwards;
}

@keyframes fadeOut {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }
    100% {
        transform: scale(0);
        opacity: 0;
    }
}

/* 奖励栏接收星星的动画 */
@keyframes rewardsPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
    }
}

.rewards.receiving {
    animation: rewardsPulse 0.5s ease-out;
}

/* 添加洗牌动画 */
@keyframes cardShuffle {
    0% {
        transform: translateY(0) rotate(0);
    }
    25% {
        transform: translateY(-10px) rotate(-5deg);
    }
    75% {
        transform: translateY(-10px) rotate(5deg);
    }
    100% {
        transform: translateY(0) rotate(0);
    }
}

/* 添加洗牌时的动画类 */
.word-card.shuffling {
    animation: cardShuffle 0.5s ease-out;
}

/* 修改错误动画样式 */
.word-card.error {
    animation: errorHeadshake 0.8s cubic-bezier(.36,.07,.19,.97) both !important;
    background: linear-gradient(45deg, #ffebee, #ffcdd2);
    border: 2px solid #ef5350;
    box-shadow: 0 0 15px rgba(239, 83, 80, 0.4);
    transform-origin: center;
    position: relative;
    will-change: transform;
}

/* 错误时的摇头动画 */
@keyframes errorHeadshake {
    0% {
        transform: translateX(0) rotate(0);
    }
    15% {
        transform: translateX(-8px) rotate(-3deg);
    }
    30% {
        transform: translateX(6px) rotate(2deg);
    }
    45% {
        transform: translateX(-4px) rotate(-1deg);
    }
    60% {
        transform: translateX(2px) rotate(1deg);
    }
    75% {
        transform: translateX(-1px) rotate(-0.5deg);
    }
    100% {
        transform: translateX(0) rotate(0);
    }
}

/* 错误时的闪烁效果 */
.word-card.error.selected {
    animation: errorHeadshake 0.8s cubic-bezier(.36,.07,.19,.97) both,
               errorFlash 0.8s ease-in-out !important;
    background: linear-gradient(45deg, #ef5350, #d32f2f);
    color: white;
    border-color: #c62828;
    box-shadow: 0 0 20px rgba(239, 83, 80, 0.5);
}

@keyframes errorFlash {
    0%, 100% {
        filter: brightness(1);
    }
    50% {
        filter: brightness(1.3);
    }
}

/* 添加错误波纹效果 */
.word-card.error::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120%;
    height: 120%;
    background: rgba(239, 83, 80, 0.2);
    border-radius: inherit;
    transform: translate(-50%, -50%) scale(0);
    animation: errorRipple 0.6s ease-out;
    z-index: -1;
}

/* 错误波纹动画 */
@keyframes errorRipple {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.8;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0;
    }
}

/* 错误计数器动画优化 */
#errors {
    color: #ef5350;
    font-weight: bold;
    transition: all 0.3s ease;
    position: relative;
    display: inline-block;
}

.error-bump {
    animation: errorCountBump 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* 错误计数增加时的动画 */
@keyframes errorCountBump {
    0% {
        transform: scale(1) translateY(0);
        color: #ef5350;
    }
    30% {
        transform: scale(1.5) translateY(-10px);
        color: #d32f2f;
    }
    60% {
        transform: scale(0.8) translateY(5px);
        color: #ef5350;
    }
    100% {
        transform: scale(1) translateY(0);
        color: #ef5350;
    }
}

/* 添加错误时的粒子效果 */
.error-particle {
    position: absolute;
    pointer-events: none;
    background: #ef5350;
    border-radius: 50%;
    animation: particleFly 0.6s ease-out forwards;
}

@keyframes particleFly {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--tx), var(--ty)) scale(0);
        opacity: 0;
    }
}

/* 添加状态项容器样式 */
.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

/* 修改状态项容器样式 */
.stat-item, .rewards {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

/* 修改左侧容器样式 */
.stats-left {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

/* 添加中间容器样式 */
.stats-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

/* 修改右侧容器样式 */
.stats-right {
    flex: 1;
    display: flex;
    justify-content: flex-end;
}

/* 添加完成时的庆祝效果 */
.celebration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #f0f0f0;
    animation: confettiFall 3s ease-in-out infinite;
}

@keyframes confettiFall {
    0% {
        transform: translateY(-100%) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* 添加星星特效 */
.star-effect {
    position: absolute;
    pointer-events: none;
    animation: starSparkle 1s linear infinite;
}

@keyframes starSparkle {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 0;
    }
    50% {
        transform: scale(1) rotate(180deg);
        opacity: 1;
    }
    100% {
        transform: scale(0) rotate(360deg);
        opacity: 0;
    }
}

/* 优化状态项动画 */
.stat-item:hover, .rewards:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

@keyframes titleFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

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

@keyframes gradientMove {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

@keyframes errorBounce {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1) rotate(-5deg);
    }
    75% {
        transform: scale(0.95) rotate(5deg);
    }
}

@keyframes gradientBG {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
} 