/**
 * 单词雨游戏样式
 * Word Rain Game Styles
 */

/* 游戏容器 */
.word-rain-game {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 20px;
}

/* 目标单词区域 */
#targetArea {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 800px;
    padding: 10px;
    background: rgba(102, 126, 234, 0.15);
    border-radius: 20px;
    text-align: center;
    z-index: 100;
    backdrop-filter: blur(15px);
    border: 2px solid rgba(102, 126, 234, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* 第一行：标题和目标单词 */
#targetArea .first-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
}

/* 目标单词标题 */
#targetArea h3 {
    color: #667eea;
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
}

/* 目标单词释义 */
#targetMeaning {
    font-size: 24px;
    font-weight: 700;
    color: #2d3748;
    transition: all 0.3s ease;
    white-space: nowrap;
}


/* 第二行：进度和时间信息 */
#targetArea .second-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 30px;
    width: 100%;
}

/* 进度信息 */
#targetArea > .second-row > div {
    font-size: 15px;
    color: #4a5568;
    margin: 0;
    font-weight: 500;
    white-space: nowrap;
}

#targetArea > .second-row > div span {
    font-weight: 700;
    color: #667eea;
    font-size: 18px;
}

/* 单词下落区域 */
#wordsContainer {
    position: relative;
    width: 100%;
    height: 100%;
}

/* 单词外层容器（负责位置） */
.falling-word-wrapper {
    position: absolute;
    height: 60px;
    will-change: transform;
    z-index: 10;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* 下落单词卡片（负责显示和交互） */
.falling-word {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    color: #2d3748;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: transform 0.2s ease;
    border: 2px solid rgba(102, 126, 234, 0.2);
    text-transform: capitalize;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    contain: layout style paint;
}

/* 单词卡片悬停效果（仅桌面端） */
@media (hover: hover) and (pointer: fine) {
    .falling-word.hovered {
        transform: scale(1.1);
        box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
        border-color: rgba(102, 126, 234, 0.5);
        background: linear-gradient(135deg, #ffffff 0%, #f0f4ff 100%);
    }
}

/* 单词卡片触摸效果（移动端） */
.falling-word.touched {
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    border-color: rgba(102, 126, 234, 0.5);
    background: linear-gradient(135deg, #ffffff 0%, #f0f4ff 100%);
}

/* 单词卡片点击效果 */
.falling-word:active {
    transform: scale(0.95);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* 匹配成功动画 */
.falling-word.matched {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: #ffffff;
    transform: scale(1.2);
    box-shadow: 0 8px 30px rgba(72, 187, 120, 0.5);
    border-color: #48bb78;
}

/* 匹配失败动画 */
.falling-word.wrong {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
    color: #ffffff;
    transform: scale(0.9);
    box-shadow: 0 4px 15px rgba(245, 101, 101, 0.5);
    border-color: #f56565;
}

/* 响应式设计 - 平板设备 */
@media (max-width: 768px) {
    #targetArea {
        width: 95%;
        padding: 10px;
        flex-direction: column;
    }
    
    #targetArea .first-row {
        gap: 10px;
    }
    
    #targetArea h3 {
        font-size: 16px;
    }
    
    #targetMeaning {
        font-size: 20px;
    }
    
    #targetArea .second-row {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }
    
    #targetArea > .second-row > div {
        font-size: 14px;
    }
    
    #targetArea > .second-row > div span {
        font-size: 16px;
    }
    
    .falling-word-wrapper {
        height: 50px;
    }
    
    .falling-word {
        font-size: 14px;
    }
}

/* 响应式设计 - 手机设备 */
@media (max-width: 480px) {
    #targetArea {
        width: 98%;
        padding: 10px;
        top: 10px;
    }
    
    #targetArea .first-row {
        gap: 8px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    #targetArea h3 {
        font-size: 14px;
    }
    
    #targetMeaning {
        font-size: 18px;
    }
    
    #targetArea .second-row {
        flex-direction: row;
        gap: 15px;
        justify-content: center;
    }
    
    #targetArea > .second-row > div {
        font-size: 13px;
    }
    
    #targetArea > .second-row > div span {
        font-size: 15px;
    }
    
    
    .falling-word-wrapper {
        height: 45px;
    }
    
    .falling-word {
        font-size: 13px;
        border-radius: 22.5px;
        transition: none;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }
    
    .falling-word.touched {
        box-shadow: 0 6px 18px rgba(102, 126, 234, 0.3);
    }
    
    /* 移动端禁用不必要的动画 */
    .falling-word.matched,
    .falling-word.wrong {
        transition: transform 0.15s ease;
    }
}

/* 响应式设计 - 小屏手机 */
@media (max-width: 360px) {
    #targetArea {
        padding: 10px;
    }
    
    #targetArea .first-row {
        gap: 6px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    #targetArea h3 {
        font-size: 13px;
    }
    
    #targetMeaning {
        font-size: 16px;
    }
    
    #targetArea .second-row {
        flex-direction: column;
        gap: 8px;
    }
    
    #targetArea > .second-row > div {
        font-size: 12px;
    }
    
    #targetArea > .second-row > div span {
        font-size: 14px;
    }
    
    .falling-word-wrapper {
        height: 40px;
    }
    
    .falling-word {
        font-size: 12px;
        border-radius: 20px;
    }
}

/* 动画效果 */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
    }
    50% {
        box-shadow: 0 8px 30px rgba(102, 126, 234, 0.5);
    }
}

/* 单词卡片发光效果（仅桌面端） */
@media (hover: hover) and (pointer: fine) {
    .falling-word:hover {
        animation: glow 1.5s ease-in-out infinite;
    }
}

/* 性能优化 */
.falling-word {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    -moz-backface-visibility: hidden;
    -ms-backface-visibility: hidden;
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    .word-rain-game {
        background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
    }
    
    #targetArea {
        background: rgba(102, 126, 234, 0.25);
        border-color: rgba(102, 126, 234, 0.4);
    }
    
    #targetMeaning {
        background: rgba(45, 55, 72, 0.9);
        color: #e2e8f0;
    }
    
    .falling-word {
        background: linear-gradient(135deg, #2d3748 0%, #4a5568 100%);
        color: #e2e8f0;
        border-color: rgba(102, 126, 234, 0.3);
    }
    
    .falling-word:hover {
        background: linear-gradient(135deg, #4a5568 0%, #667eea 100%);
    }
    
    #targetArea > div {
        color: #a0aec0;
    }
}

/* 无障碍支持 */
.falling-word:focus {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

.falling-word:focus-visible {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}

/* 打印样式 */
@media print {
    .word-rain-game {
        background: white;
    }
    
    .falling-word {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}