/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    max-width: 800px;
    width: 100%;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 标题样式 */
.title {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 2.5rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

/* 添加食物部分 */
.add-food-section {
    margin-bottom: 20px;
}

.add-food-form {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.food-input {
    padding: 12px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s ease;
    width: 200px;
}

.food-input:focus {
    border-color: #667eea;
}

.food-input.shake {
    animation: shake 0.5s ease-in-out;
    border-color: #ff6b6b;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

.add-button {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.add-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(102, 126, 234, 0.4);
}

/* 食物列表部分 */
.food-list-section {
    margin-bottom: 30px;
}

.food-list-section h2 {
    text-align: center;
    color: #555;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.food-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    max-height: 150px;
    overflow-y: auto;
    padding: 10px;
    border-radius: 10px;
    background: #f8f9fa;
}

.food-item {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    box-shadow: 0 4px 10px rgba(255, 107, 107, 0.3);
    animation: foodItemAppear 0.3s ease-out forwards;
    opacity: 0;
    transform: scale(0.8);
}

@keyframes foodItemAppear {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.food-item {
    cursor: pointer;
}

.food-item:hover {
    opacity: 0.8;
}

.food-item.deleting {
    animation: foodItemDisappear 0.3s ease-out forwards;
}

.food-item.removing {
    animation: foodItemRemove 0.3s ease-out forwards;
}

@keyframes foodItemDisappear {
    to {
        opacity: 0;
        transform: scale(0);
    }
}

.food-hint {
    text-align: center;
    color: #999;
    font-size: 0.85rem;
    margin-top: 10px;
}

/* 结果显示部分 */
.result-section {
    margin-bottom: 30px;
}

.result-section h2 {
    text-align: center;
    color: #555;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.result-display {
    background: linear-gradient(135deg, #4ecdc4, #45b7d1);
    color: white;
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 8px 20px rgba(78, 205, 196, 0.3);
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-text {
    font-size: 2rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

/* 按钮部分 */
.button-section {
    display: flex;
    justify-content: center;
}

.random-button {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 30px;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(240, 147, 251, 0.3);
    transition: all 0.3s ease;
    animation: buttonPulse 2s infinite;
}

.random-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(240, 147, 251, 0.4);
}

.random-button:active {
    transform: translateY(0);
}

.random-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    box-shadow: none;
    animation: none;
}

@keyframes buttonPulse {
    0% {
        box-shadow: 0 8px 20px rgba(240, 147, 251, 0.3);
    }
    50% {
        box-shadow: 0 12px 30px rgba(240, 147, 251, 0.5);
    }
    100% {
        box-shadow: 0 8px 20px rgba(240, 147, 251, 0.3);
    }
}

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

.spinning {
    animation: spin 0.1s linear infinite;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .container {
        max-width: 95%;
        padding: 25px;
    }
    
    .title {
        font-size: 2.2rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
        border-radius: 15px;
    }
    
    .title {
        font-size: 1.8rem;
        margin-bottom: 20px;
    }
    
    .food-list-section h2,
    .result-section h2 {
        font-size: 1.3rem;
    }
    
    .food-list {
        max-height: 120px;
        padding: 8px;
    }
    
    .food-item {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
    
    .add-food-form {
        flex-direction: column;
        align-items: center;
    }
    
    .food-input {
        width: 100%;
        max-width: 300px;
    }
    
    .add-button {
        width: 100%;
        max-width: 300px;
    }
    
    .result-display {
        padding: 30px 20px;
        min-height: 100px;
    }
    
    .result-text {
        font-size: 1.5rem;
    }
    
    .random-button {
        padding: 12px 30px;
        font-size: 1rem;
        width: 100%;
        max-width: 300px;
    }
    
    .button-section {
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 15px;
        border-radius: 12px;
    }
    
    .title {
        font-size: 1.5rem;
    }
    
    .food-list {
        max-height: 100px;
        gap: 8px;
    }
    
    .food-item {
        padding: 5px 10px;
        font-size: 0.8rem;
    }
    
    .result-display {
        padding: 25px 15px;
        min-height: 80px;
    }
    
    .result-text {
        font-size: 1.3rem;
    }
    
    .random-button {
        padding: 10px 25px;
        font-size: 0.9rem;
        border-radius: 25px;
    }
    
    .food-hint {
        font-size: 0.75rem;
    }
}

@media (max-width: 360px) {
    .title {
        font-size: 1.3rem;
    }
    
    .food-item {
        padding: 4px 8px;
        font-size: 0.75rem;
    }
    
    .result-text {
        font-size: 1.1rem;
    }
}